• Home
  • Magento
    • Magento 2
  • Adobe | Magento Cloud
  • Hyva
  • Linux
  • About Me
  • Contact Us

Rohan Hapani

Magento Tutorial | PHP Tutorial | Android Tutorial

Magento, Magento 2

How to Add Custom Tab in Customer Account Dashboard in Magento 2

April 19, 2020
How to Add Custom Tab in Customer Account Dashboard in Magento 2

In this tutorial, Today I will explain about how to add custom tab in customer account dashboard in Magento 2. When you are logged in successfully after that, you will redirect to customer account dashboard page. On customer account dashboard page, there are many tabs available like My Account, My order, Stored Payment Methods, Address book etc.

However, when you want to add your custom tab after default custom tab and call your custom template file then, how to do that?

Let’s follow the below steps to add custom tab in customer account dashboard in Magento 2.

You may also like this :

  • How to Add WYSIWYG Editor in Magento 2 Store Configuration
  • How to Reset Admin Password in Magento 2
  • Magento 2 : Add Custom Product Video in Fotorama Gallery

1) First of all, Create customer_account.xml file in your module at app/code/RH/Helloworld/view/frontend/layout/ and paste the below code :

Copy Code Copied Use a different Browser

<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Created By : Rohan Hapani
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
   <body>
      <referenceBlock name="customer_account_navigation">
         <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-mycustomtab">
            <arguments>
               <argument name="path" xsi:type="string">helloword/index/index</argument>
               <argument name="label" xsi:type="string">My Custom Tab</argument>
            </arguments>
         </block>
      </referenceBlock>
   </body>
</page>

Using this above code, you can set label and URL for your custom tab. You need to set your controller path in path argument.

2) Then, Create helloworld_index_index.xml file to add template file in your controller layout at app/code/RH/Helloworld/view/frontend/layout/ and paste the below code :

Copy Code Copied Use a different Browser

<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Created By : Rohan Hapani
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
   <update handle="customer_account" />
   <body>
      <referenceBlock name="page.main.title">
         <action method="setPageTitle">
            <argument translate="true" name="title" xsi:type="string">My Custom Page</argument>
         </action>
      </referenceBlock>
      <referenceContainer name="content">
         <block class="Magento\Framework\View\Element\Template" name="my_custom_page" template="RH_Helloworld::customfile.phtml" />
      </referenceContainer>
   </body>
</page>

3) Create Index.php action file to render your custom layout in your custom tab at app/code/RH/Helloworld/Controller/Index/ and paste the below code :

Copy Code Copied Use a different Browser

<?php
/**
 * Created By : Rohan Hapani
 */
namespace RH\Helloworld\Controller\Index;

class Index extends \Magento\Framework\App\Action\Action
{
    public function execute()
    {
        $this->_view->loadLayout();
        $this->_view->renderLayout();
    }
}
?>

4) In Last, Create customfile.phtml template file to display template file in your custom tab at app/code/RH/Helloworld/view/frontend/templates/ file path and paste the below code:

Copy Code Copied Use a different Browser

<?php // Add your code to display in your custom tab. ?>

That’s it !!!

Finally, you just need to clean cache using below command :

Copy Code Copied Use a different Browser

php bin/magento c:c

I hope this blog is easy to understand about how to add custom tab in customer account dashboard in Magento 2. In case, I missed anything or need to add some information, always feel free to leave a comment in this blog, I’ll get back with proper solution.

Keep liking and sharing 🙂

 

Post Views: 6,302
Tagged customer-account, magento2

Related Posts

How to Add Custom Global Variable in Hyva Theme Magento 2

January 6, 2025
How to Create Custom Product Slider in Hyva Theme Magento 2

How to Create Custom Product Slider in Hyva Theme Magento 2

November 23, 2024
Magento 2 Luma Theme Fallback in Hyvä theme

Magento 2 : Luma Theme Fallback in Hyvä theme

November 12, 2024

Post navigation

How to Add WYSIWYG Editor in Magento 2 Store Configuration
How to Create Custom Payment Method in Magento 2

Certification Directory

Magento-Certifications

Magento Stack Exchange

profile for Rohan Hapani at Magento Stack Exchange, Q&A for users of the Magento e-Commerce platform

Recent Posts

  • Manga Casino: Snelle Gaming voor de On-the-Go Speler
  • Sugar Rush: Eine süße Variante auf High‑Intensity Candy Slots
  • Casinia Casino: Mastering Quick Spin Sessions for Instant Thrills
  • Gransino Casino: Quick‑Hit Slots en Lightning Roulette voor Snel‑Pace Spelers
  • Kaasino Casino – Quick‑Play Slots & Lightning‑Fast Action

Most Viewed Posts

  • Magento 2 : How to Add Product Grid in UI Form using UIComponent
  • Magento 2 : Create admin grid and form without ui component
  • Magento 2 : Create UI Component Grid and Form
  • Magento 2 : Get Product Collection
  • How to Add Slick Slider in Magento 2

Categories

  • Adobe | Magento Cloud (5)
  • Android (1)
  • Hyva (5)
  • Linux (4)
  • Magento (189)
  • Magento 2 (194)
  • Uncategorized (47)

Recent Posts

  • Manga Casino: Snelle Gaming voor de On-the-Go Speler
  • Sugar Rush: Eine süße Variante auf High‑Intensity Candy Slots
  • Casinia Casino: Mastering Quick Spin Sessions for Instant Thrills
  • Gransino Casino: Quick‑Hit Slots en Lightning Roulette voor Snel‑Pace Spelers
  • Kaasino Casino – Quick‑Play Slots & Lightning‑Fast Action

Categories

  • Adobe | Magento Cloud
  • Android
  • Hyva
  • Linux
  • Magento
  • Magento 2
  • Uncategorized

Archives

  • June 2026
  • January 2025
  • November 2024
  • May 2024
  • March 2024
  • February 2024
  • November 2023
  • October 2023
  • August 2023
  • June 2023
  • April 2023
  • October 2022
  • September 2022
  • August 2022
  • June 2022
  • April 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • December 2018
  • November 2018
  • Facebook
  • Twitter
  • LinkedIn
  • YouTube
Copyright © All rights reserved.
Blog Way by ProDesigns
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT