How to Disable Compare in Magento 2 – Full Tutorial

How to Disable Compare in Magento 2 – Full Tutorial

Magento 2 offers various features for online stores, even including the features that you don’t need at all. You want to disable the Add to Compare features, but there isn’t any built-in function to do this. This Magento 2 tutorial blog will guide you in two simple ways to remove the compare product function.

You can use coding or a free Magento 2 Disable Compare extension to completely remove the “Add to Compare” feature on all pages and at all positions on products.

Option 1: How to Disable Compare Product Features Programmatically

Disable compare in Layer Navigation:

Compare products block is defined in


You add a


file to your theme in


Then remove your block as follows:

 <page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="" remove="true"/> </body> </page>

Disable compare in Product Page and Category Page:

You add the following XML instruction to your theme’s default  XML file:

 <referenceBlock name="" remove="true"/> <referenceBlock name="" remove="true" /> <referenceBlock name="view.addto.wishlist" remove="true" />


The XML file of your theme is located in




Disable compare in Header:

Add the following XML instruction to Magento_Catalog/layout/default.xml of your theme:

 <?xml version="1.0"?> <page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="" remove="true"/> <referenceBlock name="" remove="true"/> </body> </page>

Set $showCompare to false in the following templates:

 <Magento/Catalog/view/frontend/templates/product/list/items.phtml Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml Magento/Catalog/view/frontend/templates/product/widget/content/grid.phtml

Remove compare related staff from the following templates:

 <Magento/Catalog/view/frontend/templates/product/list.phtml Magento/Catalog/view/frontend/templates/product/listing.phtml Magento/Wishslist/view/frontend/templates/item/configure/addto.phtml

Option 2: Magento 2 Disable Compare Extension Free

BSSCommerce offers you the quickest, easiest and safest way to completely remove the compare button at all places. Magento 2 Disable Compare extension easily remove Add to Compare on Product Page, Category Page, Search Result Page, Layered Navigation, Widget, Related Product, Upsell Product, and Cross-sell Product.

Remove “Add to Compare” function on Product Page

Moreover, Disable Compare extension is FREE – NO code interfere – NO code – NO bug. With the free Magento 2 Disable Compare extension, you can disable compare product function on all pages and at all positions completely with just 1 simple configuration.

Simple configuration of Magento 2 Disable Compare extension

You can download the Magento 2 Disable extension free right here:

Magento 2

FOR MORE INTERESTS: take a look at Magento 2 B2B solution package to better wholesale business.

I hope that the tutorial blog is helpful for you to disable the compare product function in Magento 2. Please Like, Share, Subscribe and share your thoughts in the comment section below. BSSCommerce is always ready to assist you in case you have any questions.


Write A Comment


( 4 ) Comments

  • Waldemar

    Hello, thank you very much for the free extension. I can´t find a install guide for this extension. Is there a tutorial how to install it?


    • Stephanie

      Dear Waldemar,
      Please refer to the Installation Guide to install our Magento 2 Disable Compare extension.
      Hope it help!

  • Marc

    I would like to punch the Mage developers in the face for not including a way to disable this absolutely USELESS feature from the main admin panel. Seriously – I know a lot of developers – NO ONE and I mean NO ONE uses this idiotic feature and many of us spend hours every time we configure an install to remove it. DUMB.

  • Earl Peter

    Thanks but you should format your code for readability. 🙂