Show sub categories even if there are no products in them

This topic has 6 replies, 2 voices, and was last updated 5 years, 9 months ago ago by Rose Tyler

  • Avatar: finleydesign
    finleydesign
    Participant
    January 28, 2019 at 23:08

    Hi, is it possible to show the sub categories when viewing the category, I can only currently get them to show if there is a product that is ticked into that sub category

    However I need to show them even if there is no products in there, I have all the settings set to show both sub category and products but the sub categories aren’t showing

    5 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    January 30, 2019 at 08:17

    Hello,

    You need to unselect “Hide empty categories” in settings of Categories widget http://prntscr.com/me3kgc
    If this is not what you are looking for, provide your site and temporary wp-admin access, so I can take a closer look.

    Regards

    Avatar: finleydesign
    finleydesign
    Participant
    January 30, 2019 at 10:01

    Didn’t once mention widgets, please read the ticket again

    I just need the sub categories to be shown, even if there are no products in them, it works on other themes it’s just this theme that seems to not show a sub category if there is no product in there

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    January 30, 2019 at 10:36

    Dear,

    Our theme inherits the functionality of WooCommerce.
    Storefront – http://prntscr.com/me5fq8 http://prntscr.com/me5g0m and our theme – http://prntscr.com/me5gfc
    If you are looking for this result – http://prntscr.com/me5grb , add this code in functions.php of child theme:

    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;
    }

    Regards

    Avatar: finleydesign
    finleydesign
    Participant
    January 31, 2019 at 10:21

    Perfect thank you, worked!

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    January 31, 2019 at 10:26

    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

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