How to add/remove links on my account navigation magento 2?

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>

Leave a comment

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