Skip to content
Advertisement

Add sale badge to product thumbnail on single product page and shop archive pages in WooCommerce

I use the following code to add a small badge topleft of every product with -%off.

JavaScript

On my product page and it works. However when i try to do it on category page to all product listings with the following code:

JavaScript

It does not work, there doesn’t seem to be any adjustment. Can I get some guidance into it?

Advertisement

Answer

To add the badge to the product images on the archive pages, either you use

JavaScript

OR

JavaScript

I have also rewritten your existing code (for the single product page)

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement