2

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

  • Check the Magento-wishlist XML to see ehat item to target – Vlad Patru Dec 15 '16 at 9:47
  • Yes, targeting wish-list-link is correct, and the block inside of the magento wishlist xml is 'wish-list-link' – andy jones Dec 15 '16 at 9:54
2

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!

  • I tried this, it didn't work, maybe there is a problem with the theme. Im going to start it again, i believe this to be the right answer so it'll get a tick, but im still unsure why it isn't being removed. – andy jones Dec 15 '16 at 15:18
  • @andyjones I tried my snippet and it works fine; it could be your theme. – WaPoNe Dec 15 '16 at 15:28
  • I believe it is, this is the correct block & the correct referenceBlock name, so it has to be right. But i have no idea why it isn't removing it. I think doing it inside of the Magento_Wishlist xml is probably a better call than the theme xml as it breaks it down for the next dev using it. Thanks for the info. – andy jones Dec 15 '16 at 15:29
  • @andyjones It isn't working for me either, what parent theme were you using? I'm using the Sass blank theme but it doesn't seem to make any XML changes to the wish list. – Ben Crook Aug 24 '17 at 14:46
  • Ahh, just seen Tommy's answer below. It's coming from the multiple-wish-list-link block as it's EE. – Ben Crook Aug 24 '17 at 14:47
3

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

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>
  • Unfortunately this doesn't seem to work either. – andy jones Dec 15 '16 at 9:50
1

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>
  • No, still no luck. Also made sure that the cache was disabled and flushed - but nothing. Im going to just go and curl up in a ball and cry. – andy jones Dec 15 '16 at 11:33
  • Github here is a simple module that deletes the link to wishlist. – Vitalii Dec 15 '16 at 12:20
0

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.

  • I did the following: Added Magento_Wishlist/layout/default.xml found the correct block: <block class="Magento\Wishlist\Block\Link" name="wish-list-link" after="my-account-link"/> I then tried to remove, with that file. With no luck. – andy jones Dec 15 '16 at 9:55
0

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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