Question

I've seen this question asked time and time again, and i know this will sound like a duplicate. But every answer everyone else has doesn't work for me.

I'm using:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="top.links">
            <referenceBlock name="wish-list-link" remove="true" />
        </referenceBlock>
    </body>
</page>

To try and remove the wish-list-link from the top link set, but this doesn't seem to work, i understand that im in the right block but i assume im not targeting the correct 'wish list link' - I understand i can disable the module but i might need the module further down the line, so this really isn't an option for me.

Any help would be great.

Just to note im also inside of my theme, inside of...

/Vender/Theme_name/Magento_Theme/layout/default.xml

Was it helpful?

Solution

app/design/frontend/vendorName/themeName/Magento_Wishlist/layout/default.xml

<?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">
    <body>
        <referenceBlock name="wish-list-link" remove="true" />
    </body>
</page>

It works!

OTHER TIPS

If you're developing an Enterprise Edition site, wish-list-link is not the droid you're looking for. That block is removed and replaced with multiple-wish-list-link, thus needs to be removed as follows, in app/design/frontend/<Vendor>/<Theme>/Magento_MultipleWishlist/layout/default.xml:

<?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">
    <body>
        <referenceBlock name="multiple-wish-list-link" remove="true"/>
    </body>
</page>

Wishlist link removal can be done in two ways:using

  • Magento_Theme's default.xml
  • Magento_Wishlist's default.xml(for community edition) or Magento_MultipleWishlist(for enterprise edition)

Using Magento_Theme's default.xml: Just create Magento_Theme/layout folder in your custom theme's root and add default.xml in this layout folder with following content:

<?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">
    <body>
        <!--Will work for enterprise edition-->
        <referenceBlock name="multiple-wish-list-link" remove="true"/>
        <!--Will work for community edition-->
        <referenceBlock name="wish-list-link" remove="true" />
    </body>
</page>

Second method is to just add the Wishlist module to your custom theme and remove the block in it's default.xml.Please refer following solution both for community and enterprise edition.

For Community edition:Just create Magento_Wishlist/layout folder in your custom theme's root directory and add default.xml in this layout folder with following content:

<?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">
    <body>
       <referenceBlock name="wish-list-link" remove="true" />
    </body>
</page>

For Enterprise Edition:Just create Magento_MultipleWishlist/layout folder in your custom theme's root directory and add default.xml in this layout folder with following content:

<?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">
    <body>
       <referenceBlock name="multiple-wish-list-link" remove="true" />
    </body>
</page>

I don't think you need the first reference and you can simply do:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="wish-list-link" remove="true" />
    </body>
</page>

Try this method:

    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="top.links">
            <action method="unsetChild">
                <argument name="alias" xsi:type="string">wish-list-link</argument>
            </action>
        </referenceBlock>
    </body>
</page>

If you're having no luck with referenceBlock remove, you can override the default.xml (/Vendor/Theme_Name/Magento_Wishlist/layout/override/base/default.xml) layout file for the module in your theme and snip out the code referring to the wish list link you're trying to remove.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top