In this post I am going to explain how to add custom tab in customer account in magento 2.

In Magento 2, customer will be redirected to their account dashboard after login or signup. Customer My Account section contains various tabs such as My Account, My Orders, My Wishlist etc. Sometimes we need to add new custom tab to enhance customer shopping experience or to display some information.

Follow the steps below to add custom tab in customer account section.

Create customer_account.xml

File Path: app/code/Ht/Mymodule/view/frontend/layout/customer_account.xml

Create mymodule_customer_index.xml

File Path: app/code/Ht/Mymodule/view/frontend/layout/mymodule_customer_index.xml

Create routes.xml

File Path: app/code/Ht/Mymodule/etc/frontend/routes.xml

Create Index.php

File Path: app/code/Ht/Mymodule/Controller/Customer/Index.php

Create customtab.phtml

File Path: app/code/Ht/Mymodule/view/frontend/templates/customer/account/customtab.phtml

Thats it. Enjoy Magento 2!!