25

How to remove "Billing Agreements" and "My Wishlist" links from the navigation menu on customer account page?

4

6 Answers 6

44

Add new layout handle to one of places:

  1. If creating new module: VendorName/ModuleName/view/frontend/layout/customer_account.xml
  2. If creating new theme, 2 similar layout handles should be created to declare removal of each block separately: app/design/frontend/VendorName/themeName/Magento_Wishlist/layout/customer_account.xml (and similar layout for billing agreement module)

Layout handle 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="customer-account-navigation-wish-list-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>
    </body>
</page>
6
  • add new layout handle in location app\design\frontend\Magento right?
    – Abdul
    Commented Nov 26, 2015 at 10:02
  • Isn't it better to add it to custom module? I suppose current strategy in M2 is to allow totally modular approach, when you don't have to create different types of files in different places across codebase (like it was in M1). app/design seems to be a good place for theme developers. Commented Nov 26, 2015 at 10:06
  • currently i using luma theme then i add new layout handle in location \vendor\magento\theme-frontend-luma right?
    – Abdul
    Commented Nov 26, 2015 at 10:12
  • If you create new theme, follow devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/… . If new module, add layout to your module directory. Commented Nov 26, 2015 at 10:30
  • rakeshjesadiya.com/wp-admin/post.php?post=1844&action=edit Magento commerce and Opensouurce. Commented Dec 20, 2019 at 11:23
58

Full list of customer account XML removal for M2. It will be helpful for other developers who try to remove other links. I think it's a good idea to keep it has extra information for other developers.

<?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>
        <!-- Remove unwanted account navigation links -->
        <!-- Put this file in: app/design/frontend/[Namespace]/[Theme]/Magento_Customer/layout/customer_account.xml -->

        <!-- Store credit -->
        <referenceBlock name="customer-account-navigation-customer-balance-link" remove="true"/>

        <!-- Downloadable product link -->
        <referenceBlock name="customer-account-navigation-downloadable-products-link" remove="true"/>

        <!-- Subscription link -->
        <referenceBlock name="customer-account-navigation-newsletter-subscriptions-link" remove="true"/>

        <!-- Billing agreement link -->
        <referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>

        <!-- Product review link -->
        <referenceBlock name="customer-account-navigation-product-reviews-link" remove="true"/>

        <!-- My credit card link -->
        <referenceBlock name="customer-account-navigation-my-credit-cards-link" remove="true"/>

        <!-- Account link -->
        <referenceBlock name="customer-account-navigation-account-link" remove="true"/>

        <!-- Account edit link -->
        <referenceBlock name="customer-account-navigation-account-edit-link" remove="true"/>

        <!-- Address link -->
        <referenceBlock name="customer-account-navigation-address-link" remove="true"/>

        <!-- Orders link -->
        <referenceBlock name="customer-account-navigation-orders-link" remove="true"/>

        <!-- Wish list link -->
        <referenceBlock name="customer-account-navigation-wish-list-link" remove="true"/>

        <!-- Gift card link -->
        <referenceBlock name="customer-account-navigation-gift-card-link" remove="true"/>

        <!-- Order by SKU -->
        <referenceBlock name="customer-account-navigation-checkout-sku-link" remove="true"/>

        <!-- Gift registry -->
        <referenceBlock name="customer-account-navigation-giftregistry-link" remove="true"/>

        <!-- Reward points -->
        <referenceBlock name="customer-account-navigation-reward-link" remove="true"/>

        <!-- My Invitations -->
        <referenceBlock name="customer-account-navigation-magento-invitation-link" remove="true"/>
    </body>
</page>
5
  • How did you know the full list? I'm looking for some links which not in default of magento, please tell me how do you find this list, thanks :)
    – fudu
    Commented Oct 6, 2018 at 2:46
  • Ah nevermind, i've founded it in this link magento.stackexchange.com/questions/186056/…
    – fudu
    Commented Oct 6, 2018 at 3:12
  • 1
    Also useful: customer-account-navigation-delimiter-1 and customer-account-navigation-delimiter-2 are the names of the empty/decorative sections - aka delimiters.
    – jamil
    Commented Dec 7, 2018 at 21:54
  • won't it work if I create a structure as app/code/<Vendor>/<Module>/view/frontend/layout/customer_account.xml. I have a separate theme folder though.
    – Anto S
    Commented Apr 26, 2019 at 10:58
  • how do i get billing agreement to show? Commented Apr 6, 2020 at 12:58
2

In my mage installation (2.2.2 commerce edition) there is another link:

<!-- Invitations -->
<referenceBlock name="customer-account-navigation-magento-invitation-link-container" remove="true"/>
1
  • how do i get billing agreement to show? Commented Apr 6, 2020 at 12:58
0

I added the following css to hide the Billing Agreements tab on my customer account pages. There are better ways to do this as mentioned, but this is quick and easy!

nav.account-nav li.nav.item a[href*="billing_agreement"] {display:none;}

You could do the same the Wishlist or any other link that you want to remove. Just target the element using a selector, as explained here: https://www.w3schools.com/cssref/css_selectors.asp

0

At first I hide links in customer account MENU using CSS as #Cristina mentioned because I thought that the solution with xml will be too laborious.

But it is not complicated at all. You just need to choose links, which you would like to remove.

What is important: by looking at the source of the page's code - there are no links to as opposed to the CSS solution (display: none;)

0

If you are using Enterprise with B2B, there are some more links you may want to hide as well.

Goldy's answer above is hugely helpful, here are some additional links to hide if using B2B components.

In file: app/design/frontend/[Namespace]/[Theme]/Magento_Customer/layout/customer_account.xml

        <!-- Company Users -->
        <referenceBlock name="customer-account-navigation-company-users-link" remove="true"/>

        <!-- Company Delimiter -->
        <referenceBlock name="customer-account-navigation-delimiter-container-b2b" remove="true"/>

        <!-- Company Profile -->
        <referenceBlock name="customer-account-navigation-company-profile-link" remove="true"/>

        <!-- Company Structure -->
        <referenceBlock name="customer-account-navigation-company-link" remove="true"/>

        <!-- My Invitations -->
        <referenceBlock name="customer-account-navigation-magento-invitation-link-container" remove="true"/>

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.