Remove compare functionality in Magento 1 and Magento 2

Removecompare functionality in Magento 1 and Magento 2

It happens that users are wishing to get assistance via the helpdesk system immediately, without browsing Google before. However, there are tutorials as a good tool to cover technical support issues that may be faced by our customers. And we recommend you to follow guide steps in order to complete your task on your own. It would help you save time, above all.

Today we’re going to discuss a problem of disabling product comparison feature. We’ll explain how to remove Add to Compare button from every page of your website. You'll learn how to disable compare block from the sidebar, category page or the product page. We'll list all steps for different Magento versions separately.

Also, we've got a good offer for you at the end of an article. It will be about how to disable the default Magento “Compare” functionality much faster.

So, no wasting time. Let’s go straight to the solution.

How to disable Magento 1 compare functionality

First important steps are:

  • Copy all files into your theme folder and make changes there.
  • We don't recommend to edit core Magento files to avoid losing the changes you've made after magento upgrade.

1. Remove right column compare block.

Open the app/design/frontend/base/default/layout/reports.xml and remove the following code.

<block type="reports/product_compared" before="right.permanent.callout" name="right.reports.product.compared" template="reports/product_compared.phtml" />

Open the app/design/frontend/base/default/layout/catalog.xml and remove the following code.

<block type="core/template" before="cart_sidebar" name="" template="catalog/product/compare/sidebar.phtml"/>

You can also use another way to remove that block without editing and dublicating core xml files. Please create local.xml file in your theme folder app/design/frontend/<your_package>/<your_theme>/layout/local.xml:

<?xml version="1.0" encoding="UTF-8"?>
        <remove name="right.reports.product.compared" />
        <remove name="" />

You have to remove compare links from templates manually as will be shown in instruction points 2 and 3.

2. Remove Compare link from the product page.

Open the app/design/frontend/base/default/template/catalog/product/view/addto.phtml and remove the following code.

    $_compareUrl = $this->helper('catalog/product_compare')->getAddUrl($_product);
<?php if($_compareUrl) : ?>
    <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
<?php endif; ?>

3. Remove Compare link from product list page in two places for grid and list mode.

Open the app/design/frontend/base/default/template/catalog/product/list.phtml and remove the following code.

<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
    <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
<?php endif; ?>

How to remove product comparison in Magento 2

First important steps are:

  • We don't recommend to edit core Magento files to avoid losing the changes you've made after magento upgrade.
  • Create new theme inheriting from Luma and make all modifications there.

1. Remove compare block from sidebar.

Open the app/code/Magento/Catalog/view/frontend/layout/default.xml and remove the following code.

<referenceContainer name="sidebar.additional">
    <block class="Magento\Framework\View\Element\Template" name=""
            <argument name="jsLayout" xsi:type="array">
                <item name="components" xsi:type="array">
                    <item name="compareProducts" xsi:type="array">
                        <item name="component" xsi:type="string">Magento_Catalog/js/view/compare-products</item>

You can also use another way to remove that block without editing and duplicating core XML files. There is no local.xml in Magento 2, however, you can remove blocks in inherited theme in Magento_Theme/layout/default.xml.

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

You have to remove compare links from templates manually as will be shown in instruction points 2,3 and 4.

2. Disable the Compare button on product list page.

Open the app/code/Magento/Catalog/view/frontend/templates/product/list.phtml and remove the following code.

   $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');
<a href="#"
   class="action tocompare"
   title="<?php echo $block->escapeHtml(__('Add to Compare')); ?>"
   aria-label="<?php echo $block->escapeHtml(__('Add to Compare')); ?>"
   data-post='<?php /* @escapeNotVerified */ echo $compareHelper->getPostDataParams($_product); ?>'
    <span><?php /* @escapeNotVerified */ echo __('Add to Compare') ?></span>

3. Disable the Compare button on product page.

Open the app/code/Magento/Catalog/view/frontend/templates/product/view/addto.phtml and remove the following code.

<a href="#" data-post='<?php /* @escapeNotVerified */ echo $compareHelper->getPostDataParams($_product);?>'
        class="action tocompare"><span><?php /* @escapeNotVerified */ echo __('Add to Compare') ?></span></a>

4. Remove the Compare button in related, new, upsell, cross-sell and other product list blocks.

Open the following list of templates included Luma Magento 2 theme:


For each product list block please change

$showCompare = true;


$showCompare = false;

We hope this tutorial adds values to your query. As we've promised, we suggest you to review the quick solution that will help you to:

  • hide default Magento “Compare” functionality
  • enable “alternative” Compare page design

Magento 2 Compare module is the solution. It allows removing a compare functionality in Magento 2. Instead, the module offers you to improve a compare page design with:

  • Sticky header while scrolling
  • Sticky attributes columns
  • The display of all product attributes or just the products' differences

You can use these features in case you still want to keep comparison shopping at your store.


You can also review some more useful articles that will help you to experiment with Magento functionality:

Please tell us what issues you’d like to have discussed next time. Drop us a line in comments. We appreciate your ideas.

Popular Magento Themes & Extensions

10 thoughts on “Remove compare functionality in Magento 1 and Magento 2”

  • Chamath

    How do we override following file

    But I couldn't find that file there. I was under vendor folder as follows.


    I copied it in to my theme folder to override as follows.


    But it not working. Is there any other way to do this?

    • Chamath

      My fault
      Overridden path must be as follows


      Issue was here - Magento_CatalogWidget. Earlier it was Magento_Catalog_Widget

  • Coquelicot

    Hello i'm using Magento 2.1.7, i've removed the compare sidebar thx to this tutorial but when i go to app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

    I can't find the code you say in my file.

    How to solve it ?


    • Roman B.

      Magento moved it into separate block.

      Now you need to open layout file:


      and comment lines 25-27:

      <block class="Magento\Catalog\Block\Product\ProductList\Item\AddTo\Compare"
      name="" as="compare"

  • Sreenu

    what is url for wishlist in magento2 in default.xml

  • gomage

    Thanks for sharing all of your experiences!

  • magento plugin development
    magento plugin development July 10, 2019 at 2:53 pm

    Love your resources! I appreciate your details and depth writing style and all your eye cache points was so awesome.

  • Miley Cryus

    Thanks for sharing these tips! I am sure your tips really helpful!

Leave a Reply