By default, Magento 2 has long list of customer account. But sometimes not all links are needed. Often it’s needed to remove, for example, My Credit Cards link or remove My Downloadable Products link.
Here is the list of default links in customer account navigation:
- Account Dashboard
- Account Information
- Address Book
- My Downloadable Products
- My Orders
- Newsletter Subscriptions
- Stored Payment Methods
- My Product Reviews
- Billing Agreements
- My Wish List
In Magento 2 Enterprise Edition there are some additional links:
- Store Credit
- Order by SKU
- Gift Card
- Gift Registry
- Reward Points
- My Invitations
In order to remove customer links in Magento 2 you need to create layout instructions to remove needed blocks.
For example, Billing Agreements link corresponds to the block with name customer-account-navigation-billing-agreements-link
So, the resulting layout update will look like this:
<?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-billing-agreements-link" remove="true"/> </body> </page>
It is also possible to change link title and reorder customer account links. For changing link text you need to call setLabel for the corresponding block. Reordering can be done using reorderChild method of layout.
Removing customer account links using extension
We created a simple and useful extension for Magento 2 that allows to manage customer account links from admin.
Key features of the module:
- Remove unnecessary links
- Change link labels
- Change position of the links
- Compatible with Enterprise Edition
- Supports custom links added by 3rd-party extensions
You can check more details on the extension page https://magery-themes.com/magento-2-account-links-manager.html