cancel
Showing results for 
Search instead for 
Did you mean: 

Remove Compare Icon

Remove Compare Icon

Hi,

 

Does anyone know how I can remove the icon from the Magento 2 widget: "Catalog New Products List".

 

It is the icon in yellow:

 

https://imgur.com/AefV9tb

 

Magento 2.3.5

 

6 REPLIES 6

Re: Remove Compare Icon

Hello @callam_kidsaw ,

 

This icon is used to compare products, there are several places you'll find it. You can remove all icons at one time.

Create default.xml file in Vendor/Extension/view/frontend/layout  and copy the below code:

<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>

Make sure you flush Magento cache after creating this file.

 

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: Remove Compare Icon

Thank you, I will try this as soon as I can and accept as solution if it works.

 

I managed to find something similar while Googling, but it only removed about half of the compare buttons / links etc.

Re: Remove Compare Icon

Hi,

 

I have this code already in my default.xml file.

 

It has removed most of the compare icons, but the ones in the image I provided are still there.

 

Any ideas?

Re: Remove Compare Icon

I think this came with your theme, so you can follow this process to remove this icon :

  1. grep the class-name/text around it/any tag and search in your project from where it's phtml is coming (app/design/*).
  2. check if this icon has a specific block for it then you can copy that block name and add in default.xml with remove tag, if not then you can remove that code from phtml.

As there is no functionality in admin to disable this functionality so we have to do this way.

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: Remove Compare Icon

This feature is built into Magento by default and can be accessed here [If you want to try it].

 

Content > Pages > Edit any page > Content > Insert Widget > Catalog New Product List

 

I removed it with CSS in the end, using very simple code:

 

.action.tocompare {
            	   display: none !important;
                 }

Not sure how much old technologies are used now, but it should be hidden for 99% of web users.

 

Re: Remove Compare Icon

@callam_kidsaw 

 

I think this will hide only particular page, and hiding by CSS is not a great idea as it will be hidden only in frontend. Rest depends on your requirement if you're fine with that, go that way.

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy