How to Making a Menu in My Account menu on Magento 2 frontend?

Most of the time, as a Magento 2 extension developer, we have to dip our hands into both backend and frontend. In this blog, I will present to you how to make a Menu in customer’s My Account menu on frontend. I will use my example code in one of our module: GiftRegistry.

This picture denotes our expected outcome:

add menu on magento n2


We will create a database for the table, our table’s data will be from this database.

Make a file named magenest_registry_event in Setup/InstallSchema.php


Next up, create our table’s model: Model/Event.php




 This is where frontend components are handled frontend/layout/customer_account.xml.

This is the file which add a Tab named My Gift Registry in the My Account menu of a customer. The data will be passed onto giftregistry/customer/registry controller for handling. Make sure the path is correct. 

After that, we need to create one more layout file which will create a block and its template frontend/layout/giftregistry_customer_registry.xml

 Add frontend/templates/customer/gifregistry/list.phtml

This is the template file which add the table components and display it. You can customize it to suit your need.


Better late than never, lets create our controller file in Controller/Customer/Registry

This will put List Gift Registry as the title of the page.


This is one crucial part, make a file named Block/Customer/Registry/ListGift.php

This is the place where data will be received from database and handled then passed onto the template file to display.

Relevant Entries
How To Configure Amazon API In Magento 220171002200046
How to Configure Google API in Magento 220170926200035
Social Login: What Is It?20170913200003