How to Show the Percentage Discount on the WooCommerce Sale Badge

A percentage badge only helps when it is calculated from the price the cart charges. Use a snippet for WooCommerce sale prices, or a Disco Pro badge that reads your campaign discount.

Shanjida Haider
Content Writer
Last Updated:
5 min read
How to Show the Percentage Discount on the WooCommerce Sale Badge

A $40 shirt marked down to $30 and a $400 jacket cut to $300 wear the same WooCommerce label: “Sale!”. One is 25% off, the other saves $100, and shoppers must do that arithmetic themselves.

A WooCommerce sale badge percentage swaps the generic word for the figure, such as “-25%”. It earns its place only when it’s correct, which means it has to be calculated from whatever the cart will actually charge. Where your markdown lives decides how you build it.

Match the badge to where the discount lives

Reductions reach a WooCommerce product through two routes, and the label must read the one you use.

Route one is the product’s own sale price field, filled in by hand or by import. WooCommerce stores that value, and its badge check, is_on_sale(), looks at it.

Route two is a rule from a plugin. Disco applies campaign discounts live rather than saving them into that field. Code that reads the stored sale price therefore isn’t guaranteed to notice a Disco campaign, while Disco’s badge fills in the discount of the campaign it belongs to.

Use both on one product and the label can disagree with checkout, so choose which route owns each item.

Show the WooCommerce sale badge percentage with a snippet

For prices entered in WooCommerce itself, the label passes through a filter named woocommerce_sale_flash inside the loop/sale-flash.php template (WooCommerce source). Return different markup and WooCommerce prints it in place of the default label.

This version covers simple and variable products. Variable products have no single price, so it shows the deepest variation saving with “Up to” in front:

add_filter( 'woocommerce_sale_flash', function( $html, $post, $product ) {
    $best = 0;
    $is_variable = $product instanceof WC_Product_Variable;
    $items = $is_variable ? array_map( 'wc_get_product', $product->get_visible_children() ) : array( $product );
    foreach ( $items as $item ) {
        if ( ! $item || ! $item->is_on_sale() ) { continue; }
        $regular = (float) $item->get_regular_price();
        $sale    = (float) $item->get_sale_price();
        if ( $regular > 0 && $sale < $regular ) {
            $best = max( $best, round( ( $regular - $sale ) / $regular * 100 ) );
        }
    }
    if ( ! $best ) { return $html; }
    $prefix = $is_variable ? 'Up to -' : '-';
    return '<span class="onsale">' . esc_html( $prefix . $best . '%' ) . '</span>';
}, 10, 3 );

Paste it into a child theme’s functions.php or a code snippets plugin, then open a reduced item and compare. Keeping the onsale class preserves your theme’s styling, and when no saving can be computed the original label returns.

Remember its blind spots. It only knows WooCommerce sale prices, so a Disco campaign on that item may leave the figure stale, and it only changes templates that call woocommerce_sale_flash; check block-theme product grids separately.

Show the campaign’s percentage with Disco Pro

If Disco campaigns set your prices, let the campaign print its own label. Product discounts work in the free plugin; the Product Badge that displays them is a Pro design block.

Setup, per Disco’s product badge documentation:

  1. Create or open a product campaign with a percentage discount, then click Continue at the bottom of the editor.
  2. Toggle Product Badge to Enabled and click Edit Now.
Disco campaign display step with the Pro Product Badge block and its Edit Now button
  1. Pick an editable design and type text containing [discounted_percentage], for example “SAVE [discounted_percentage]”. A preview shows the result, “SAVE 30%” on a 30% campaign.
  2. Adjust size, placement and colors, click Update, then finish from the summary step.
Disco Pro Product Badge customizer with badge designs, text and style settings

Disco’s documentation describes the placeholder as the campaign discount percentage, filled in automatically on products the campaign covers, so there’s no second copy of the number to maintain.

WooCommerce product page with a Disco percentage badge on the product image

Percentage or amount?

Percentages aren’t always more persuasive. Wharton marketing professor Jonah Berger’s Rule of 100 puts it plainly: “under 100 percentage discounts seem larger than absolute ones,” while “Over 100, absolute discounts seem larger than percentage ones” (source).

Apply it item by item. That $40 shirt reads better as “-25%”; the $400 jacket sounds bigger as “Save $100”. With the snippet, change its label to the saved amount for expensive goods. In Disco, campaigns covering pricier stock can use [discounted_amount], which inserts the reduction as a currency value.

Still need to create the reduction itself? See how to apply a percentage discount in WooCommerce. For wording, colors or placement, read how to change the sale badge text, color and position.

Before launch, test one simple and one variable product, and compare each label with its cart line. Get Disco free for discounts, and see Disco Pro pricing for the Product Badge.

FAQ

Does WooCommerce show the discount percentage on the sale badge by default?

No. The default label says “Sale!” on every reduced product. Showing a percentage takes a snippet on the woocommerce_sale_flash filter or a badge tool.

Is the Disco percentage badge free?

No. Disco’s product discounts are free, but the Product Badge that prints the percentage is a Pro feature.

Why does my badge show the wrong percentage?

It is probably reading a different price than the cart uses. A sale-price snippet may not see plugin discounts, and a fixed label repeats one number everywhere. If the badge is missing entirely, see sale badge not showing.

Written by

Shanjida Haider

Shanjida Haidar is an emerging writer whose work blends metaphor, introspection, and refined narrative craft. Formerly known by the pseudonym “Eriza Alica,” she has authored five titles on Wattpad and further developed her voice through consistent, reflective blogging. She is currently pursuing a master’s degree in English Language Teaching at the University of Dhaka, with academic interests spanning language education, child development, philosophy, and psychology. Professionally, Shanjida works as a WooCommerce Writer at WebAppick. She remains committed to continuous growth—both as a writer and as an educator—striving to produce work that is purposeful, insightful, and resonant.

Leave a Comment

Ready to Boost Your WooCommerce Sales?

Join 700+ store owners using the best WooCommerce discount plugin. Start free or go Pro for BOGO, bulk discounts, and dynamic pricing.

14-Day Money-Back Guarantee • 5-Year Loyalty Rewards • Lifetime Updates