Magento2: How to create or add a menu or link at customer myaccount left navigation in Magento2
In this post, I will show you how we can add a menu link of our custom module page in myaccount left navigation page.
You can create it by following below steps:
Step 1: Create a customer account handle xml in path app\code\Mynamespace\HelloWorld\view\frontend\layout\customer_account.xml, if already not created and add the below code insidei <body> tag in xml file.
Code to Add:
Step 2: Now open your custom module handle xml file for example here I am taking helloworld module with index controller and index action.
app\code\Mynamespace\HelloWorld\view\frontend\layout\helloworld_index_index.xml
and add the code
Code to Add:
Step 3: Refresh Cache and you have done it.
You can create it by following below steps:
Step 1: Create a customer account handle xml in path app\code\Mynamespace\HelloWorld\view\frontend\layout\customer_account.xml, if already not created and add the below code insidei <body> tag in xml file.
Code to Add:
<referenceBlock name="customer_account_navigation">
<block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-helloworld-list-link">
<arguments>
<argument name="path" xsi:type="string">helloworld</argument>
<argument name="label" xsi:type="string">HelloWorld List</argument>
</arguments>
</block>
</referenceBlock>
Step 2: Now open your custom module handle xml file for example here I am taking helloworld module with index controller and index action.
app\code\Mynamespace\HelloWorld\view\frontend\layout\helloworld_index_index.xml
and add the code
Code to Add:
<update handle="customer_account"/>
above the <body> starting tag.Step 3: Refresh Cache and you have done it.
Magento2: How to create or add a menu or link at customer myaccount left navigation in Magento2
Reviewed by Web Technology Funda
on
6:27:00 AM
Rating:
No comments