Remove Customer Account Navigation Links in Magento 2

By default, Magento 2 provides many links in the “My Account”. Always we don’t need all the links and we have to customize this section. So today in this post I will show you how to easily remove unnecessary customer navigation links.

You can use this code in your custom theme or custom module.

1. In theme

Create customer_account.xml file to the path app/design/frontend/[Namespace]/[Theme]/Magento_Customer/layout/

or

2. In custom module

Create customer_account.xml file to the path
app/code/[Vendor]/[Module]/view/frontend/layout/

3. Use tag in XML file

<?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>
        <!-- Remove Account Dashboard -->
        <referenceBlock name="customer-account-navigation-account-link" remove="true"/>

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

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

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

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

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

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

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

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

        <!-- Remove My Wish List -->
        <referenceBlock name="customer-account-navigation-wish-list-link" remove="true"/>
    </body>
</page>

Leave a Reply

Your email address will not be published. Required fields are marked *