Step 1: Create customer_account.xml
Step 2: Manage the Custom Links
Add a Custom Links
Re-order links
Delete the link
Step 1: Create customer_account.xml
Before you can add, delete or re-order the links, the first thing you will have to do is creating customer_account.xml in your theme. Please follow the below instruction:
app/design/frontend/mageplaza/mytheme/Magento_Customer/layout/customer_account.xml
Step 2: Manage the Custom Links
Add Custom Links
To add a new Custom Links, all you have to do is copy the following code:
<referenceBlock name=”customer_account_navigation”>
<block class=”Magento\Framework\View\Element\Html\Link\Current” name=”customer-account-navigation-custom-link” after=”-” >
<arguments>
<argument name=”label” xsi:type=”string” translate=”true”>My Label</argument>
<argument name=”path” xsi:type=”string”>my-path</argument>
</arguments>
</block>
</referenceBlock>
Then add it to your layout xml file. Remember to custom Link label and path
Re-order links
To change order of the links, you need to move the element from its original place and place it back. And asking Magento 2 to place it after or before the link that you want simultaneously.
<move element=”YOUR_ELEMENT_NAME” destination=”customer_account_navigation” after=”YOUR_NEW_PLACE”/>
In this case, I will do an example to move My Wish List menu item after My Orders:
<!– eg. “My Wish List” move after “My Orders” –>
<move element=”customer-account-navigation-wish-list-link” destination=”customer_account_navigation” after=”customer-account-navigation-orders-link” />
Or before Order Links menu item:
<!– eg. “My Wish List” move before “My Orders” –>
<move element=”customer-account-navigation-wish-list-link” destination=”customer_account_navigation” after=”customer-account-navigation-orders-link” />
Delete a link
To make it simple and easy to follow, below is the example to show you the method to remove all the links from the navigation one at a time.
Syntax to remove:
<referenceBlock name=”block-name-here” remove=”true”/>