If you’re a webshop owner chances are you’re running a business that gives discounts / sales from time to time. WooCommerce already comes with a great sales feature out of the box which works great. You can even set a specific end date for a specific sale price which will be disabled automatically after that date has passed.

In some scenario’s you may like to disable all sale prices at a certain point, which isn’t possible through a core feature in WooCommerce. The code snippet displayed below will help you to disable (/ re-enable) the sale prices through the entire store at once.

You can use this code snippet by copy/pasting it to your (child) themes functions.php file. Uncomment line 11 to disable the sale prices, and re-comment it do enable the sale prices again.

Jeroen Sormani

I'm a professional WordPress plugin developer on a mission to create the best plugins for my clients. I'm specialised in developing general WordPress, WooCommerce and Easy Digital Downloads plugins.

Interested in talking about a WordPress project? Get in touch!

Follow me on Twitter

12 thoughts on “Disable product sale prices store-wide

Bojan April 16, 2016 at 1:07 pm

Thank you very much for this code.

I googled for an hour and finally I found this topic.

It work fantastic.

William Genske September 25, 2016 at 2:43 am

Thanks very much for your post and for the code.

I have added this code seemingly successfully, and it seems to work on “simple products” , but it is still showing “SALE” on all “variable” items.

I’m wondering what additional lines of code would be needed to disable the “Sale” prices to be show?

Thank you very kindly.

http://mediterranean-estates.com/shop

Jeroen September 25, 2016 at 9:19 pm

Hi William,

I haven’t tried it with variable products, but I think you can copy the code above, do a search and replace for:
– ‘woocommerce_get’ -> ‘woocommerce_get_variation_’

Run that aside from the other code above.

Again, I haven’t tested it, so be sure you know what you’re doing 😉

Cheers,
Jeroen

Andre Di Carlo June 19, 2018 at 8:17 pm

It doesn’t seem to work for product variations. How exactly would you modify the code for variations? I tried adding “get_variations” but its still not working.

Rob February 15, 2017 at 7:05 pm

Hi William,

I was experiencing the same issue you were. A scheduled sale in WooCommerce had ended but products were still showing the “sale” icon next to them and sale pricing on the product pages. Once product was actually added to the cart and the checkout page, the non-sale price would appear, but we had issues with customer’s complaining they thought they were buying product on sale and had to honor sale prices even though our sale had ended.

Rather than modifying the functions.php file (for those that are less comfortable playing with the code), I solved this on our site by going into the variable tab for each product and typing a price identical to our regular price for the product into the sales price field. It will return an error message as you type saying “please enter in a value less than the regular price.” But, enter that number anyways and tab to the next field. The number will disappear from the sales price field and will not be accepted by the form. But, if you to scroll to the bottom of the list of variations for that product and click the “save changes” button (I only had to do this once per page of variations for each product, not in every variation… It’s basically just to activate the save changes button). Once changes were saved, click the “Update” button in the Publish box in the top right corner and it should clear the “Sale” button and price from your site and restore regular pricing.

Seems like this should happen on its own when a scheduled sale expires and is a bug in the WooCommerce Plugin, but it’s a simple enough work around until they resolve it.

Regards,
Rob

Felix June 16, 2017 at 6:15 am

Hey man!

My savior! Your code works perfectly even on variable products.

ali July 22, 2017 at 12:17 am

god bless you bro
it was exactly what i was looking for!
thanks lot.

ali July 22, 2017 at 12:27 am

but what if we want to keep some categories on sale?
is there any code to disable sale, base on categories?

Dileep Raddella August 1, 2017 at 4:19 pm

Hi Jeroen ,

This code worked for my site very well

Thank You

Ray October 11, 2017 at 6:53 am

Hi – I got a bunch of deprecated notices. https://cl.ly/080T0L1d1l0Q

Any fix or update that you could provide?

Much thanks!

Jeroen October 11, 2017 at 9:24 am

Updated, Thanks!

udi September 10, 2023 at 1:23 pm

Thank you very much, very helpful

Leave a Reply