How to Show Discounted Prices on Out-of-Stock Products in WooCommerce

Posted on: by Stephen Ainsworth

If you’re using the Advanced Woo Discount Rules plugin by Flycart to create dynamic pricing or quantity-based discounts, you might notice something frustrating:

Discounts and strikeout prices don’t display for out-of-stock variations or products.

This is the default behavior of the plugin — it hides discounts for variations that aren’t available for purchase.

But what if you still want to show those discounted prices anyway?

  • To highlight promotions, even when stock is low or empty
  • To show consistent pricing logic for catalog-style stores
  • Or just because you don’t want the plugin to decide visibility for you

Good news: there’s a simple one-line fix.

The Fix: Use a WordPress Filter

The plugin provides a filter hook that lets you override its behavior. Just add the following code to your site:

add_filter('advanced_woo_discount_rules_do_strikeout_for_out_of_stock_variants', '__return_true');

This tells the plugin:

Yes, go ahead and show discounted prices even if the variation is out of stock.

Where to Add This Code

  1. Add to functions.php
  2. Go to your WordPress dashboard
  3. Navigate to Appearance → Theme File Editor
  4. Open your theme’s functions.php
  5. Paste the code at the bottom:
add_filter('advanced_woo_discount_rules_do_strikeout_for_out_of_stock_variants', '__return_true');

If you’re using a child theme (recommended), edit the child theme’s functions.php.

What You Should See

Once the filter is active, refresh a product page where:

A variation is out of stock, and

It normally qualifies for a discount

Instead of hiding the price, WooCommerce should now show:

<div class="price">
  <del><span>£14.00</span></del><br>
  <ins><span>£13.30</span></ins>
</div>

Why Is This Hidden by Default?

The plugin authors decided that showing prices for out-of-stock variations might confuse shoppers — especially if the discounted product isn’t purchasable. That makes sense for some stores.

But in many cases, hiding prices leads to inconsistent UX, particularly with variable products.

That’s why this filter exists — you stay in control.

About the Author

stephen ainsworth

Stephen Ainsworth

Stephen is a web developer who has been building websites and applications for over a decade. He continues to build projects and solutions for clients and enjoys teaching others in his field.

Follow Stephen on Socials

Share on Socials

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*