Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey @mstudioil,

    Are you saying you’d like to place a badge on the actual category saying that it is on sale?

    One way to do that would be to place a sale notice in the category description. Depending on the theme, that would be one possibility for indicating there is a sale on that category.

    Another would be to actually edit the category image so that it includes sales text.

    If you don’t mind doing some custom coding, you could add in a custom field to the category, like with a checkbox that indicates that it is on sale. Then write a function that adds an extra class to the body tag on that page. You could use that class as a hook to add a banner in via CSS.

    That would take a bit of work, but it’s another option. You could use Advanced Custom Fields to create the checkbox for the category. Here’s a tutorial on adding a class to the body tag to finish up the rest.

    https://code.tutsplus.com/tutorials/adding-to-the-body-class-in-wordpress–cms-21077

    Best

    Thread Starter mstudioIL

    (@mstudioil)

    Thanks, Yes I want to place a badge on category saying that it is on sale, like it shown on products, I done it by changing the image to image with badge, but it is lot of work, I prefer to have check box saying the category is on sale.
    I think it need to be part of WooCommerce.
    How do I add the custom coding? I didn’t found anything on Google
    The link is not working

    That is really weird. It looks like the system pulled out one of the - from the URL to that article. I’m going to try linking to it via a hyperlink instead and see if it works.

    How to add classes to the body tag

    What that post will show you how to do is conditionally add a class to the body tag. You’ll need to add a checkbox to the product category screen to designate a sale. You could use the Advanced Custom Fields plugin for that.

    I hope that gets you pointed in the right direction.

    Cheers

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘sale badge on categories’ is closed to new replies.