Hide empty categories - by tommytai - on WordPress WooCommerce support

This topic has 6 replies, 3 voices, and was last updated 4 years, 8 months ago ago by Rose Tyler

  • Avatar: tommytai
    tommytai
    Participant
    April 15, 2020 at 05:39

    Dear Support,

    1) Try to hide the empty categories http://prntscr.com/rz3rcj

    But the category page is not the widget, there is no option to hide categories, what should I do in this case?
    https://exoreptiles.com/my/product-category/supplies-accessories/supplement-treatment/powder-supplement/

    as I click on “Zoo MED Calcium” and it shows empty inside.

    I tried the below code that given by support but is not working, it is still there and the arrangement changed:

    add_filter( ‘woocommerce_product_subcategories_hide_empty’, ‘hide_empty_categories’, 10, 1 );
    function hide_empty_categories ( $hide_empty ) {
    $hide_empty = FALSE;
    // You can add other logic here too
    return $hide_empty;
    }

    Could you help to check on it.

    Thanks a lot Support!

    Please, contact administrator
    for this information.
    5 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    April 15, 2020 at 17:12

    Hello,

    Problem is that WooCommerce does not think that category is empty, we enabled the default WooCommerce theme Storefront and it displays 2 in the category but once you visit it there are no products https://gyazo.com/25c77a0cc7959476171ec4fb758b8087
    We can do nothing with this. Contact WooCommerce support because it’s not related to theme.

    Regards

    Avatar: tommytai
    tommytai
    Participant
    April 16, 2020 at 03:40

    HI there Support,

    Thanks for the info.

    This category products are all set as out of stock, it is because of this Woocommerce does not think it’s empty? Can we hide in another way?

    Hope you can help, thanks!

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    April 16, 2020 at 10:07

    Hello,

    That’s strange but I have visited the mentioned category and don’t see empty subcategories any more. Could you check if you still have any empty categories? Maybe WooCommerce database update solved the issue.

    Regards

    Avatar: tommytai
    tommytai
    Participant
    April 17, 2020 at 08:47

    Dear Olga,

    Just checked it and looks okay now.

    By the way, thanks a lot for your helped.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    April 17, 2020 at 09:03

    Hello,

    You’re welcome!

    Regards

  • Viewing 6 results - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.