• Resolved harf4ng

    (@harf4ng)


    Hi,

    On my website I’m using the “product-category” shortcode like this:
    [product_category category=”entrepots” per_page=”12″ columns=”4″ orderby=”date” order=”desc” class=”product-entrepots”]

    I have put a class on this, so then I could use this kind of stuff to add a title for my products:

    .product-entrepots:before {
      content: "Nos entrep?ts :";
      font-weight: bold;
    }

    My problem is, if there is no product in the given category, the title is still displayed. The only workaround I found was to put a display none in my css when there is no product, but then I have to consider myself if there are products in the category or not.

    Isn’t there a way to not display the class at all if there is no product in the category?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    You’d need to alter the body_classes function by first checking whether the WooCommerce loop found any products.

    Your best bet would be to get in touch with a web developer to create that for you or perhaps with one of the Woo Experts at https://woocommerce.com/customization/

    We haven’t heard back from you in a while, so I’m going to mark this as resolved. If you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide shortcode class when no content’ is closed to new replies.