• Resolved SYPOMark

    (@sypomark)


    Hi there,

    I wonder if you can help.

    Using the WooCommerce Products widget, I am hoping to add a class of current if the product being viewed matches the name of the product in the widget.

    A page of the site I am trying to add this to is https://sypotest9.co.uk/product/as300/

    I have so far worked out that the files I probably need to copy and modify are /templates/content-widget-product.php and /includes/widgets/class-wc-widget-products.php. But, I am not sure how.

    Any help that anyone could provide would be most appreciated.

    With kind regards,

    Mark

    https://www.ads-software.com/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Claudio Sanches

    (@claudiosanches)

    From what I can see you have only 8 products and using the widget as a menu (you hide price and thumbnails by CSS…). Really I recommend use a menu widget instead. So the menu will indicate the current link automatically without the need for any custom code.

    Thread Starter SYPOMark

    (@sypomark)

    Hi Claudio,

    Thanks for your swift reply.

    That is a very simple and elegant solution. I had not thought of that. I’ve implemented, and it works just as you said it would. Now all I have to do is style it up.

    Thanks again.

    Mark

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding class of current within WooCommerce Products Widget’ is closed to new replies.