0

I'm looking for a way to show the compare feature only on category or product pages but not on other pages like CMS pages.

I found several ways to disable the entire compare feature but can't find out how to remove the sidebar from other pages other than category or product pages.

1 Answer 1

0

If you want to remove compare on the sidebar then you have to add in the layout XML file

<referenceBlock name="catalog.compare.sidebar" remove="true"/> 

The above content is pasted under the XML <body> tag in catalog_category_view and catalog_product_view

enter image description here

3
  • Thnx, the sidebar itself is ok but I would like to remove the compare block from the sidebar on other then category and product pages.
    – Bas
    Commented Dec 21, 2021 at 14:36
  • I have changed my answer. so please check. Commented Dec 22, 2021 at 5:58
  • you have to add "<referenceBlock name="catalog.compare.sidebar" remove="true"/>" is pasted under the XML <body> tag in catalog_category_view and catalog_product_view Commented Mar 15, 2022 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.