Chances are a lot of your products are on sale and you find the sales badge littered everywhere a little “overwhelming” and have an urge to remove all of them? Don’t worry you are not alone. We will show you 2 simple ways to get rid of sales badges!
Preparing the work area
We highly advise you to create a child theme before making any modifications if you haven’t done so already. This is common practice as your customizations will not be lost or affected whenever the themes and plugins are updated. We will be using the functions.php file and styles.css file extensively in this post, so please make sure you understand how to create/access those files for your child theme.
Method 1: Adding a Filter in functions.php
The first method involves editing the functions.php file and pasting the following code:
// Hide sales badge:
It is as simple as that. Just save your functions.php file and test it out. This method essentially hard filters a false flag to force Woocommerce into not executing the sales badge. Woocommerce has decided to call it a “sales flash”.
Method 2: Add Custom CSS to styles.css
The second method involves editing the styles.css file and pasting the following code:
And that’s it. Very simple and elegant as well. Just save your styles.css file and test it out.
Both of these functions should be effective to remove the “On Sales” badge that shows up on top of your product images.
That’s it for this simple tutorial! Don’t forget to leave any questions or comments below.