4

I want to remove 'Add To compare' links all over the website. The Add To Compare module is irrelevant for me. I am using Magento 2.2.0 version.enter image description here

6 Answers 6

4

You can remove it by adding this line in your catalog_category_view.xml:

<referenceBlock name="category.product.addto.compare" remove="true" /> 
1
  • This is the right answer for removing the "Add to compare" link from the products in category page. Apr 23, 2019 at 14:17
3

Could you please catalog.compare.link in your default.xml find below path.

app\design\frontend\Magento\theme\Magento_Theme\layout

0

You can remove it by adding a default.xml file to your theme in: /Magento_Catalog/layout/default.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="catalog.compare.sidebar" remove="true"/>
    </body>
</page>
0

To remove the 'Add to compare' link from your product details page, you can add the foll lines to the catalog_product_view.xml file you place in:

app/design/frontend/(Vendor)/(themename)/Magento_Catalog/layout

XML code:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="view.addto.compare" remove="true" />
    </body>
</page>

This way you can keep your settings apart from each other, so the removal will be set in de file it belongs to.

-1

Please add catalog.compare.link in your default.xml find below path - >

app\design\frontend\Magento\theme\Magento_Theme\layout

<?xml version="1.0"?>
    <!--
    /**
     * Copyright © Magento, Inc. All rights reserved.
     * See COPYING.txt for license details.
     */
    -->
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
               <referenceBlock name="catalog.compare.link" remove="true"/>
               <referenceBlock name="catalog.compare.sidebar" remove="true"/>
enter code here
        </body>
    </page>
-1

Connect via SSH and run the following commands in the root folder:

Step 1: php bin/magento module:enable Mage_DisableCompare

Step 1: php bin/magento setup:upgrade

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.