• Resolved dandomix

    (@dandomix)


    Hello,

    I used this code

    add_filter( 'woocommerce_product_subcategories_hide_empty', '__return_false' );

    to show empty categories and work, but I need to show empty subcategory of that category too, if I click to the empty category no subcategory are shown, that code seems to work with first level category only and don’t work with subcategories.

    Could anyone tell me what code I can use to show even empty subcategories of an empty category?

    Example: CAT A (empty) – SUB CAT A (EMPTY), with that code only CAT A is displayed and if I click on CAT A the category not show the subcategory if is empty.

    In Woocommerce option “Show Categories” and “Show Subcategories” are selected.

    Thanks in advance

    • This topic was modified 2 years, 10 months ago by dandomix.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    Example: CAT A (empty) – SUB CAT A (EMPTY), with that code only CAT A is displayed and if I click on CAT A the category not show the subcategory if is empty.

    Hmm…that code should apply to sub categories too. I’ve tried this on my test site, and empty sub categories are displayed under an empty parent category: https://snipboard.io/ht3S1d.jpg

    In Woocommerce option “Show Categories” and “Show Subcategories” are selected.

    Can you go to Products > Categories > [CAT A], and make sure that Display type is set to either “Default” or “Sub Categories”?

    If the issue persists, your theme or another plugin may be conflicting with that code – in which case, I’d recommend running a conflict test: https://docs.woocommerce.com/document/how-to-test-for-conflicts/

    Thread Starter dandomix

    (@dandomix)

    Thanks for the reply, I think is a theme issue, I try to investigate.

    Thanks

    Mirko P.

    (@rainfallnixfig)

    Hi @dandomix,

    I can confirm the empty subcategories are displayed under the empty parent categories using the snippet you’ve provided. It could be that is not working on your setup due to a theme or plugin conflict though.

    Please do a conflict test and let us know your findings.

    Cheers.

    Thread Starter dandomix

    (@dandomix)

    Hi @rainfallnixfig,

    yes I tried the snippet in a default Woocommerce theme and that issue not occur.

    I found a customization that the theme developers made on the theme I purchased that ovverride the default woocommerce features, I sent a ticket to theme support before work on code by myself.

    Thanks

    Hi @dandomix

    Thanks for confirming that the issue did not occur on a default WooCommerce theme.

    It is great that you’ve already contacted the theme support team.

    I’ll mark this thread closed as you’ll be receiving further support from the theme’s helpdesk.

    If you have further questions, please feel free to open a new topic.

    Thread Starter dandomix

    (@dandomix)

    @margaretwporg Thanks, I managed to solve this issue by customize the theme

    Glad to hear it – thanks for letting us know!

    Feel free to create a new topic if you need assistance with anything else.

    Cheers

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to show empty subcategories in an empry category’ is closed to new replies.