Support » Plugin: Menu Item Visibility Control » Exclude empty product categories on Woocommerce

  • fremag


    Hi there,

    Great plugin – simple idea but versatile.

    I was hoping you’d be able to help…

    I’m putting together a Woocommerce site which has various products for sale in different categories (eg: furniture, lighting, soft furnishings etc.) and subcategories too (eg: furniture>dining room or furniture>living room).

    I have a main dropdown menu which has all of these categories/sub-categories in it but some can be “empty” depending on the items I have in stock at a given time, in which case I’d like them to be excluded from the dropdown menu.

    Is there a statement I can use to exclude a category from the menu if it has no products or if all the products within it show zero stock? I have tried quite a few basic options to get started such as:

    get_category(‘furniture’)->category_count > 0

    but this will simply omit the funiture category regardless.

    Apologies if this is super simple – I’m a total novice with code and I spent quite a lot of time searching and trying out different options but I’m not getting anywhere.

    Thanks in advance.

  • The topic ‘Exclude empty product categories on Woocommerce’ is closed to new replies.