Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Walter Lee

    (@saltern)

    I checked the behavior your reported with the default WooCommerce categories widget for the StoreFront theme and it is consistent with my widget’s behaviour.

    But I may have missed out something.

    To help me better understand your problem.

    Please post an image of how your categories are set up in the admin for the product in question. And also the settings for my widget as well.

    Thanks.

    Thread Starter smile7

    (@smile7)

    The problem is with every category.
    Here are the widget settings:
    https://imagebin.ca/v/2ZzXAAfHPLDR
    And the categories:
    https://imagebin.ca/v/2ZzX17ISdxFb

    Here is the link to the website:
    https://souvenir.trimata.guru

    There are test categories only. To find out what I am talking about, you can check the last category on the sidebar as there are subcategories.

    Plugin Author Walter Lee

    (@saltern)

    Thanks for the images.

    The behaviour you pointed out is how the default WooCommerce Categories widget (and also my widget) works.

    Unfortunately, I’m not sure if its a WooCommerce bug or feature so I’ll need to check with them before I can make any changes or else it might affect other users of this widget as well.

    In the meantime, you can check whether the following code change fixes the problem you encountered.

    Edit the file /wp-content/plugins/xo10-woocommerce-categories-widget/includes/widgets/class-categories.php

    Look for the following code around line 334.

    $this->current_cat = end( $product_category );

    Change it to:

    $this->current_cat = reset( $product_category );

    Refresh your browser and go to the product page again. See if the “current-cat” is now highlighted.

    Let me know if the fix works before I raise the issue on WooCommerce’s GitHub page.

    Thread Starter smile7

    (@smile7)

    It is working now, after the change I made to the code.

    Thank you very much ??

    Plugin Author Walter Lee

    (@saltern)

    Thanks for getting back to me.

    I’ve brought the issue to the WooCommerce developers attention and will update the plugin depending on how they address the problem.

    Note that if my plugin is updated to reflect any changes in WooCommerce, you may need to update the widget options again because the changes I recommend you make will be over-written.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Class 'current-cat' is removed when on single product’ is closed to new replies.