In Magento 2, whenever customers register and login to store, they are redirected to “My Account” section. This section has default tabs like Account information, orders, product reviews, wishlist etc. in which respective data is displayed and stored. Now sometimes you want to create a custom module and show some custom tab loaded with some important information. For example, you have created an extension for refund management and want customers to allow refund request from frontend. Here, you will need to create a separate custom tab with a form to allow refund requests. This can be done through adding custom tab in customer account section in Magento 2.
Follow the steps listed below to add custom tab on customer account section on frontend in Magento 2.
Add below files into your custom extension.
Ex: Namespace: Magecomp
Modulename: Mycard
- Create customer_account.xml into Magecomp/Mycard/view/frontend/layout
mycard/customer/index My Cards
- Create mycard_customer_index.xml into Magecomp/Mycard/view/frontend/layout
My Card
- Create Index.php into Magecomp/Mycard/Controller/Customer