• Hello,
    I am using the product category widget in my sidebar. I know there is the option to only show child/subcategories and this is exactly what I need, but I still need the sibling categories displayed when there are no child/subcategories. Example:

    The structure is

    Clothing
    Pants
    red
    yellow
    blue
    Shirts
    Skirts

    So on the “red”, “Yellow” and “blue” cateegory pages it should still show “red”, “yellow” and “blue” in the widget instead of nothing, which is the default since these categories don’t have any child categories.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there ??

    At the moment, there’s no default option for that in WooCommerce and that would require quite a bit of additional coding. Please kindly note that this requires some custom coding – which goes beyond the scope of support we are able to provide in this forum.

    However, in the meantime, you could enable the Show Hierarchy + Only show children of the current category to have a kind of similar behavior that you would like to use.

    https://www.screencast.com/t/uWH0XOpl4gbR

    We’d recommend you hire a developer who can take a look at this, quote you for their services and help you add this feature to your site. We’d recommend getting in touch with a web developer or one of the customization experts listed at https://woocommerce.com/customizations/.

    Cheers!

    Thread Starter fellter2

    (@fellter2)

    @gabrielfuentes Thanks, the “show hirarchy” option is not what I need though. I only need to dislay child categories, and for the “lowest” child categories that don’t have any child categories themselves, the sibling categories should be displayed.Does this make sense?

    neon101

    (@neonwebdesign)

    Hi There

    I also need this functionality, I have level 1 product category navigation in my header.

    When a user selects a level 1 category they see level 2 categories displayed in the Product Category widget. However, when they go to a level 2 category, the widget displays nothing. Best practice would be to show them the level 2 category they are in and its siblings.

    Many thanks

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Yes, I can see that but at the moment, there’s no default option for that in WooCommerce, and setting that as the default would require quite a bit of additional coding. Please kindly note that this requires some custom coding – which goes beyond the scope of support we are able to provide in this forum.

    I’d recommend you hire a developer who can help you add this feature to your site. Here are a list of one of the customization experts listed at https://woocommerce.com/customizations/.

    Cheers!

    neon101

    (@neonwebdesign)

    It feels as though the code is in widgets/class-wc-widget-product-categories.php around line 180 and needs reworking, is there any documentation available on modifying code such as this?

    Thanks

    neon101

    (@neonwebdesign)

    I’ve just realised there is a really simple way to do this using css with only ‘show hierarchy’ enabled in the widget and css like this:

    .woocommerce #woocommerce_product_categories-2 ul.product-categories > li.cat-item:not(.current-cat):not(.current-cat-parent) {
    	display: none
    } 

    Hope this helps @fellter2

    • This reply was modified 3 years, 10 months ago by neon101.
    Thread Starter fellter2

    (@fellter2)

    @neonwebdesign if I use your code, no category is displayed at all in the widget.

    neon101

    (@neonwebdesign)

    Ah I can’t write the code for you, as I don’t know your system setup.

    I just posted that to demonstrate the kind of CSS needed to show and hide the information effectively. Hope it gives you a steer.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Product category widget’ is closed to new replies.