Website Building » WooCommerce » How Do I Change the Color of My Sale Badge in WooCommerce?

How Do I Change the Color of My Sale Badge in WooCommerce?

Last updated on January 18, 2023 @ 12:49 pm

If you’re running a WooCommerce store, you may want to change the color of your sale badge to better match your store’s theme or style. Luckily, this is relatively easy to do with a little bit of code. Here’s how:

First, you’ll need to find the CSS file that controls the sale badge. This can be found in your store’s theme folder.

If you’re using a child theme, it will be located in the child theme folder. If you’re not sure which file to look for, you can try searching for “sale” or “discount”.

Once you’ve found the right CSS file, open it up and look for the code that controls the sale badge. It will look something like this:

woocommerce-page span.onsale {
background-color: #ff0000;
}
PRO TIP: If you are considering changing the color of your sale badge in WooCommerce, be aware that this may adversely affect your sales. A change in color may make your badge less visible to potential customers, which could lead to fewer sales. Proceed with caution and test your new badge color before making it permanent.

The part that says “background-color” is what controls the color of the sale badge. In this example, the badge is red (#ff0000).

To change the color, simply replace that hex code with the hex code for the color you want.

And that’s it! Save your changes and check out your newly colored sale badge.

Conclusion:

Changing the color of your sale badge in WooCommerce is easy to do with a little bit of code. Simply find the CSS file that controls the badge, and then replace the hex code for the background color with the hex code for the color you want. Save your changes and check out your new badge!

Dale Leydon

Dale Leydon

Sysadmin turned Javascript developer. Owner of 20+ apps graveyard, and a couple of successful ones.