Hello, Magento Friends!
Magento 2 comes with various traits that might or might not benefit us. One such functionality is to compare products. With this utility, the specifications of two or more products can be easily demonstrated to customers.
Let’s dive deep in!
Contents
What are Compare Products?
The Compare Products functionality lets us show the user detailed information of two or more products that are alike in category and characteristics. Two or more products are placed adjacent to each other to demonstrate clear segregation between them to the end-user. This functionality of comparing products is built-in.
So if you have a store which sells appliances, software or machines then this might be a good fit for your business as the customers need to compare two products in terms of their features and the range of price. On the other hand, if your store is of clothing and accessories then you might not require this feature as its buying depends mostly on the person’s likings and the availability of size.
Let’s get into the method to disable Compare Products in Magento 2
Method to Disable Compare Products for Magento 2
Create a default.xml file in the below-given path:
app\design\frontend\Themes\Yourtheme\Magento_Catalog\layout\
Now, add the below-given code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<?xml version="1.0"?> <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="catalogsearch.product.addto.compare" remove="true"/> <referenceBlock name="category.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> |
That’s it! You’re good to go.
Wrapping It Up!
Integrate the above code and you will be able to disable the Compare Products seamlessly. Still, if you face any challenges with not getting proper results, you can reach out to us via the comments section below.
If you are looking to make your store fully Magento featured and don’t have the know-how of Magento, then Hire a Dedicated Magento Developer who can custom-develop your Magento store.
Happy Coding!