How to disable enable Magento 2 compare product

In the last post, we have already discussed how to discuss 2 of the Wish List feature in Magento. All of us know how Magento 2 is powerful with many features. But I would like a guest list, and the function of the goods for many shop owners is inappropriate. Compare detailed and side-by-side comparisons of two or more products. You can customize the claim to add additional attributes or remove the ones you do not want to add. Depending on the theme, compare the link and represented by an icon or text.

Magento 2 Compare Products
In Magento 1.x, in some cases, you have to set an extension to remove your products from comparing, but it’s easy on Magento 2. Now, I will show you some simple steps to compare Magento 2 products.

The list does not want to disable comparing the work, and there is no option in the administration. You have to ignore it
module-catalog/view/frontend/templates/product/list.phtml template
To do so, you have to copy the content of the above file into the new file of your theme below:


Next the following command:

$compareHelper = $this-&gt;helper('Magento\Catalog\Helper\Product\Compare');
&lt;a href="#"
 class="action tocompare"
 title="&lt;?php echo $block-&gt;escapeHtml(__('Add to Compare')); ?&gt;"
 aria-label="&lt;?php echo $block-&gt;escapeHtml(__('Add to Compare')); ?&gt;"
 data-post='&lt;?php /* @escapeNotVerified */ echo $compareHelper-&gt;getPostDataParams($_product); ?&gt;'
 &lt;span&gt;&lt;?php /* @escapeNotVerified */ echo __('Add to Compare') ?&gt;&lt;/span&gt;

Very simple, right?

But if you want to change your decision and compare products, you do not have to review it, because now we will show you how to close this process:
1. In the Admin sidebar, tap the stores. Then, under Settings, select Configuration.

Magento 2 Compare Products
2. In the panel on the left side of the list, select the list.
3. Expand the recently viewed/compiled products section. Then do the following:

  • Set up the current display for the store view at the Internet, Store, or Configuration.
  • The default number of recently viewed products enter the number of a recently visited count in the Count field. Default number of recently added products, enter a recent number
    Compiled products will appear in the list.

4. When finished, tap the Save Copy.
Note: The number of products listed on each web page can be configured for each website, store or store view.

Last Update: March 2, 2018  

March 2, 2018   1204   Nandini Ramachandran    Marketing    
Total 1 Votes:

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Reply

Your email address will not be published. Required fields are marked *