Site logo

[Resolved] Removing the sale badge on products that are out of stock

Home Forums Support [Resolved] Removing the sale badge on products that are out of stock

Home Forums Support Removing the sale badge on products that are out of stock

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #2564199
    Willya

    Hi, I want to remove the sale badge on products that are out of stock. Is this possible?

    #2564303
    Leo
    Staff
    Customer Support

    Hi there,

    Give this CSS a shot:

    .woocommerce.post-type-archive .products li.outofstock .onsale,
    .single-product .product.outofstock .onsale {
        display: none;
    }

    Learn how to add CSS: https://docs.generatepress.com/article/adding-css/

    #2564429
    Willya

    Thank you, Leo! It worked.

    I forgot, how about if I want to hide it on the product page as well?

    #2564448
    Leo
    Staff
    Customer Support
    #2564471
    Willya

    Thank you Leo. It worked!

    #2564616
    Willya

    Hi Leo,

    I just realized that the sale badge appears on related products and may also appear on upsell products. Can it also be removed?

    Updated: I can do it with the help of chatGPT, haha

    .woocommerce .related .product.outofstock .onsale,
    .woocommerce .upsells .product.outofstock .onsale {
        display: none;
    }
    
    #2565110
    Leo
    Staff
    Customer Support

    Glad to hear 🙂

    #2566730
    Willya

    Hi Leo,

    I have applied a load more button to my category archive page, but after doing so, the sale badge reappeared and I don’t know which CSS class to use to hide it again.

    #2566743
    Fernando
    Customer Support

    Hi Willya,

    Can you name a specific products that’s out of stock which has the sale badge?

    #2566794
    Willya

    For example, this product (link provided in private).

    Alternatively, you can click on the “Load More” button located on the product category page (link also provided in private) to view products that are sold out (I have decided to implement a function where out of stock products appear at the end, which is why you have to click the “Load More” button first to see the out of stock products.)

    #2566809
    Fernando
    Customer Support

    Try this instead:

    .woocommerce .product.outofstock .onsale,
    .woocommerce .product.outofstock .onsale {
        display: none !important;
    }
    #2567011
    Willya

    Thank you Fernando! That did the trick.

    #2567893
    Fernando
    Customer Support

    You’re welcome, Willya!

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.