3

Is there a way to disable the compare function in admin panel?

  • Can you add more information, what you exactly want? – Sohel Rana Jul 27 '16 at 13:35
  • I want to remove the compare list in the navigation bar and also the "add to compare list" button in the product grid. Is there any suggestion? – Paul Jul 27 '16 at 16:21
6

As of 2.1 theres no way to disable the compare functionality in the Backend.

The only thing you can do is via the theme:

In your Magento_Catalog/layout/default.xml of your theme you need the following code to remove the sidebar:

<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>

On top of that you need Magento_Catalog/layout/catalog_product_view.xml with the following code to remove the link on the product page:

<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>

Then to remove the compare link from the product list you need to edit Magento_Catalog/templates/product/list.phtml and remove/comment the compare lines.

| improve this answer | |
  • I'm using Magento 2.0 but I will have a try on your solution. Thanks! – Paul Jul 28 '16 at 3:02
  • Tried in 2.0. It works! – Paul Jul 28 '16 at 4:08
  • Accept the answer if it helps you @zzpaul so it help other community members – Keyur Shah Jul 28 '16 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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