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.
12 thoughts on “Disable product sale prices store-wide”
Thank you very much for this code.
I googled for an hour and finally I found this topic.
It work fantastic.
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
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
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.
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
Hey man!
My savior! Your code works perfectly even on variable products.
god bless you bro
it was exactly what i was looking for!
thanks lot.
but what if we want to keep some categories on sale?
is there any code to disable sale, base on categories?
Hi Jeroen ,
This code worked for my site very well
Thank You
Hi – I got a bunch of deprecated notices. https://cl.ly/080T0L1d1l0Q
Any fix or update that you could provide?
Much thanks!
Updated, Thanks!
Thank you very much, very helpful