2

This question already has an answer here:

I have been able to remove every link to add to compare but I cant get the one away that is placed beside the add to cart button on the category page.


enter image description here

marked as duplicate by Siarhey Uchukhlebau, Flyingmana, liyakat, sv3n, Keyul Shah Sep 2 '17 at 6:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4

Update your extended default.xml file and Find it at your extended theme path

app/design/frontend/vendor-name/theme-name/Magento_Theme/layout/default.xml

To remove compare from listing Page add this line of code

<referenceBlock name="category.product.addto.compare" remove="true"/>

This is how your default.xml will look like

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>


        <referenceBlock name="category.product.addto.compare" remove="true"/>   <!-- BLOCK Removed on Category page-->




    </body>
</page>

Keep cache disabled and run following commands if needed

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

Tested and it works, should help you out as well

  • You need not run setup:upgrade or static-content:deploy for this task. Just need to clear or flush cache. For more details about when you should run which command prefer my answer: magento.stackexchange.com/questions/184921/… – Prince Patel Sep 1 '17 at 6:04
  • I followed the instructions but it didnt help. 2 questions: Should I put default.xml in app/design/frontend/vendor-name/theme-name/Magento_Theme/layout/default.xml or app/design/frontend/vendor-name/theme-name/Magento_Theme/templates/layout/default.xml and is it enought with a single line default.xml (<referenceBlock name="category.product.addto.compare" remove="true"/>) or does it need additional code? – Kaki Sami Sep 1 '17 at 12:34
  • didn't get you , is compare link removed ? – Manoj Deswal Sep 1 '17 at 12:35
  • I updated my comment. – Kaki Sami Sep 1 '17 at 12:37
  • put inside your Magento_Theme/layout/ – Manoj Deswal Sep 1 '17 at 12:37

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