DEV Community

loading...

Remove product compare - Magento 2

Paboda Hettiarachchi
I'm a Magento programer. Like to travel and have work life balance so love to work remotely.
・1 min read

There is no configuration setting to remove Product "Compare" feature in Magento2. This can be done via layout file. (for
example: in app/design/frontend/vendor/theme/Magento_Theme/layout/default.xml

<referenceBlock name="catalog.compare.link" remove="true"/>
<referenceBlock name="category.product.addto.compare" remove="true"/>
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
<referenceBlock name="view.addto.compare" remove="true" />
<referenceBlock name="related.product.addto.compare" remove="true" />
<referenceBlock name="upsell.product.addto.compare" remove="true" />
<referenceBlock name="crosssell.product.addto.compare" remove="true" />
<referenceBlock name="catalogsearch.product.addto.compare" remove="true"/>

tested in Magento 2.4.0

Discussion (0)