Reply 344537 to: Bug > Compare button x2 in related products and custom style don’t work

Avatar: Rose Tyler
Rose Tyler
Support staff
January 20, 2023 at 17:09

Hello @MJJONE,

Ok, let’s describe the details from the code side. YITH Compare plugin has its own PHP class which is used for main actions. As you may see from the next screenshot -> https://prnt.sc/4qOwu7lZ3PgO YITH_Woocompare_Frontend class does not have a method for getting the instance of itself so any other theme/plugin could ask the main YITH_Woocompare_Frontend class for calling its functions in the places where someone needs. But according to the situation, YITH Compare plugin not providing such methods, we are calling that YITH_Woocompare_Frontend class one more time inside our files -> https://prnt.sc/L3fxOpOOnozXand call the next function of this class -> add_compare_link(). It is done to show compare button in our Single Product builder. But calling that class make a trigger of __contstruct main function of YITH_Woocompare_Frontend class where they add their buttons on each action ‘woocommerce_after_shop_loop_item’ -> https://prnt.sc/lFFSJtJi4KRd so that is why you have double compare buttons. To prevent the such situation we recommend you use our Built-in Compare or use the custom CSS we shared before.
We hope, our ‘coding knowledge information’ was useful.

King Regards,
8theme team

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.