Magento2 Module – Safely Disable Compare Products & Wishlist

comparemagento2modulewishlist

I am building Magento 2.0 only to sell 2 of my products online. The compare products and wishlist module is irrelevant for me.

How I safely and easily remove those modules? I dont want to hack the core code.

Best Answer

In Magento 2, you can actually now remove Compare products functionality via xml file. Compare products block is defined in vendor/magento/module-catalog/view/frontend/layout/default.xml

and you can remove it by adding a default.xml file to your theme in: <theme_dir>/Magento_Catalog/layout/default.xml

inside which you remove your block as following:

<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"/> 
        <referenceBlock name="wishlist_sidebar" remove="true" />
    </body>
</page>
Related Topic