0

Each product has a "Add to Compare" link with it and the catalog list page has a "Compare Products" section in the sidebar. I want to remove all trace of compare functionality in my template.

All the answers and help have been on Magento 1.* versions. They don't work in Magento 2.

1 Answer 1

2

I'm quite new to Magento2, but I think you should look into vendor/magento/module-catalog/view/frontend/templates/products/list/items.phtml.

Search for $showCompare. Just set it to false, should work.

4
  • Wow, it's really hard coded in the templates, I don't see any other way either, except overriding Magento\Catalog\Helper\Product\Compare and let all the get*Url() methods return an empty string. Commented Mar 7, 2016 at 15:34
  • Yep, same conclusion. I think it would be better to override template file since it is an "aesthetic" modification. $showCompare = false; after the switch. Commented Mar 7, 2016 at 15:47
  • Agreed, under this conditions. I was just baffled that you cannot configure it, not even via layout XML action. Commented Mar 7, 2016 at 15:49
  • Quite weird... but AFAIK they are still hardowrking on making all the code compliant with the guidelines. So maybe in the next future. Commented Mar 7, 2016 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.