Tuesday , April 16 2024
Home > Magento Tips & News > Magento 2 Tutorials > Marketing > How to Disable Compare Products in Magento 2

How to Disable Compare Products in Magento 2


Each time people surf the websites to purchase products, they tend to read information about several products and compare their features. They can spend hours researching the characteristics of products, as those goods are not appreciated for appearance, but primarily for their capabilities. In fact, product reviews and ratings influence customer’s decisions significantly. 

Compare Products in Magento 2 plays an essential role in the quality of the eCommerce website. It helps audiences easily decide to purchase the product they need by comparing product ratings, main product features, product pros and cons. In this article, I will present Compare Products in Magento 2 overview and how to disable it in case of unnecessity.

What is Magento 2 Compare Products?

Magento 2 Compare Products is a function that audiences can use to compare all of the products they are interested in. Comparison table template displays characteristics and features of goods that they chose, allowing users to determine benefits and drawbacks of products easily.

Besides, a well-conducted comparison table can push your sales because customers could be more likely to buy if they find a product better than others.

Pros and Cons of Magento 2 Compare Products


1. Pros

  • Salient Add to compare button in both category page and product page
  • Control the attributes in a comparison table.
  • Delete products from the list simply
  • Display product ratings
  • Price and Add to Cart buttons in outstanding points.
  • Print button available

2. Cons

  • Not mobile-friendly
  • Removing a product from the product compare site causes page reload.
  • Can’t hide the same features of compared products
  • Yes/No attributes appear with text, not icons.
  • The page will reload when you add products to a comparison table. It causes an uncomfortable user experience because of slowness.
  • Cannot disable compare products Magento 2 for a particular product, product category, or entire store from Admin panel. (This is pretty basic. I will guide you below.)
Other contents in Magento Marketing:
How to Show and Disable Product Reviews in Magento
How to Configure the Wishlist in Magento 2

How to Disable Compare Products Magento 2?

Obviously, there are many online shops that do not need a comparison table, especially websites selling low-priced products, such as accessories, clothes, shoes, foods,…

However, Magento 2 Compare Products is automatically enabled in Magento Open Source. You cannot disable it using Admin sidebar configuration. We need some basic codes to edit. Now, we will help you.

Step 1: Remove Compare Products in Magento 2 at all places at frontends such as Header, Product, Category pages, and Layer Navigation.

Step 2: Add the following XML instruction to your theme in app/design/frontend/Theme_Vendor/Theme_Name/Magento_Catalog/layout/default.xm:

<?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">
	 	<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="view.addto.compare" remove="true" />
          <referenceBlock name="related.product.addto.compare" remove="true" />

Step 3: Set $showCompare variable to false in the following templates:

Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml

How to Edit Recently Viewed/Compared Products in Magento 2

Unlike the Compare Products, it is possible to customize the Recently Viewed / Compared products in Configuration Settings on the Admin panel.

So, how to edit Recently viewed/compared Products in Magento 2?

  1. On the Admin sidebar, go to Stores > Settings > Configuration 
  2. Expand Catalog, then choose Catalog > Recently Viewed / Compared Products.
  1. Synchronize widget products with backend storage – This setting determines whether it will synchronize the products shown with your current product storage availability. You can choose No.
  2. On the Show for Current, choose website, store, or store view where the configuration applies.
  3. On the Default Recently Viewed Products Count, fill the number of viewed products that you want to appear on the list.
  4. On the Default Recently Compared Products Count, fill the number of compared products you want to appear on the list.
  5. Lifetime of products in Recently Viewed Widget: This setting determines how long the products viewed will be shown in the recently viewed list.
  6. Lifetime of products in Recently Compared Widget: Works the same as the above-described setting, but it applies to the recently compared products list instead.
  7. Save Config to finish.

Bottom Line

Magento 2 Compare Products is not too difficult to control, isn’t it? Comment down below to share your thought. Follow our blog to get more useful Magento tutorials.

At Magezon, we also provide you with many fast, well-coded yet affordable extensions for your store optimization. Visit our website to opt for necessary ones!

Optimize Your Magento Store With Powerful Extensions

Looking for fast, efficient and well-coded extensions to build or optimize your Magento stores for sales boosting? Then visit Magezon website and grab necessary add-ons for yours today!

About Taylor Nguyen

Taylor Nguyen
I was born and grew up in Hanoi. I got 3 years of experience in Digital Marketing. To me, reading is food, and writing is a release of my energy. Thus, balance in the application of these is an important part of my life.

Check Also

How to Add Canonical URL in Magento 2

There might be many issues in your websites that you must figure out and eliminate. …

Leave a Reply