How to Add a Custom Link in My Account Navigation
Would you like to extend the navigation in customer's "My Account" area in Magento 2 by adding a new link? Let's see how easily you can do that!
First of all we will need to find out they responsible layout and block for the navigation menu. The layout is the customer_account.xml and the block is the customer_account_navigation.
Simply create a customer_account.xml file under your theme directory /app/design/frontend/VENDOR/THEME/Magento_Customer/layout/ and add the following code.
As you can see we add a new block to the already existing block customer_account_navigation. The new block is called customer-account-navigation-custom-link and we pass also some arguments needed from the layout to the block like the label, path and sort order. For the sort order we set a low value so our custom link will be displayed at the end of the navigation menu.
In "My Account" area, the navigation menu will look like now as below.
Feel free to share this post and ask your questions in the comments below.
Till next time!