Disabling the compare product feature in Magento 2 can be essential for streamlining the user experience and cleaning up product pages. Depending on your Magento 2 version and specific needs, several methods exist to achieve this. Below, we delve into some common approaches suitable for both the Community Edition and the Enterprise Edition.
Community Edition
Removing Compare Product Links from the Layout
For those who need a more definitive removal beyond just admin settings, adjusting the layout XML files is your go-to option:
- Remove from Product List:
Edit the file located at app/design/frontend/[Vendor]/[theme]/Magento_Catalog/layout/catalog_category_view.xml and include the following XML snippet to remove the compare link:<referenceBlock name="category.product.addto.compare" remove="true" />
Remove from Product Details:
Edit the file located at app/design/frontend/[Vendor]/[theme]/Magento_Catalog/layout/catalog_product_view.xml and add:<referenceBlock name="product.info.compare" remove="true" />
Remember to flush the cache after making these changes to ensure they take effect.
Using a Plugin to Disable Functionality
Consider a plugin for those less familiar with coding or preferring a straightforward solution. The Disable Compare Magento 2 extension is available for free. Simply install it, and you can relax knowing the compare functionality is disabled.
Enterprise Edition
Since the Enterprise Edition is a paid version, it includes an admin configuration option to disable product comparison easily:
- Log in to the Magento Admin.
- Navigate to Stores > Configuration > Catalog > Catalog.
- Under the Storefront section, find the Allow All Customers to Compare Products option and set it to No.
- Save Config.
This setting will prevent customers from comparing products on your site.
Need Further Assistance?
Feel free to contact us for any queries or additional help related to disabling comparison features or other Magento-related issues. We are here to help!
Leave a Reply