In this article, I will provide a guide on how to disable the Compare Products feature in Magento 2. Compare Products is a useful tool for customers as it allows them to compare the details of multiple products and make an informed decision on which one to purchase. However, for some stores, this feature may not be necessary, and disabling it can improve performance and streamline the store’s functions.
The Compare Products feature in Magento 2 allows users to view detailed information of similar products side by side, making it easy to compare categories and characteristics. It is particularly useful for stores that sell phones, electronics, and home appliances that focus on hardware, features, and price.
To disable Compare Products in Magento 2, follow these steps:
- Go to app/design/frontend/Theme_Vendor/Theme_Name/Magento_Catalog/layout.
- Create a file named default.xml and add the following 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=“catalog.compare.link” remove=“true”/> <referenceBlock name=“catalog.compare.sidebar” remove=“true”/> <referenceBlock name=“category.product.addto.compare” remove=“true”/> <referenceBlock name=“catalogsearch.product.addto.compare” remove=“true”/> <referenceBlock name=“crosssell.product.addto.compare” remove=“true”/> <referenceBlock name=“related.product.addto.compare” remove=“true”/> <referenceBlock name=“upsell.product.addto.compare” remove=“true”/> <referenceBlock name=“view.addto.compare” remove=“true”/> </body> </page>
Magento vs Shopify: Which E-commerce Platform is Right for Your Business?
If you wish to disable the compare feature in Magento 2, you can follow these steps:
- Log in to the Magento 2 admin panel.
- Go to Stores > Configuration > Catalog.
- Under the Catalog tab, expand the Catalog option.
- Set the “Allow Products Comparison” option to “No”.
- Click on the “Save Config” button to save the changes.
This will remove the Compare Products link from the front of your store, and users will no longer be able to add products to the Compare Products list.