4

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

2
  • Can you add more information, what you exactly want?
    – Sohel Rana
    Commented Jul 27, 2016 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?
    – TFS
    Commented Jul 27, 2016 at 16:21

1 Answer 1

8

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.

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

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.