How to Create a Tab and Load Grid in Magento 2 Customer Admin Edit Page

Store owners try to get maximum information about their customers in order to understand their purchase behaviour, the pattern of thinking, and purchase power. It helps craft an effective marketing strategy that benefits the business.

Similarly, Magento 2 store owners try to get customer information while registering or checkout process.

However, the story does not end here. The admin may want to operate on these details or in some cases, update them from the backend.

For example, if the admin wants to get the list of all the products purchased in the store till now, and based on order total, update the customer group from the backend, he may need to create a tab and load grid in Magento 2 customer admin edit page.

Doing so makes it easier for the admin to check and update the customer details of any particular customer from the backend.

The below solution shows how to do the same for any custom fields added on the checkout page or any page in the store frontend that is responsible to collect customer data.

Get that customer data in the grid of the customer admin edit page under the custom tab you create using the below method:

Method to Create a Tab and Load Grid in Magento 2 Customer Admin Edit Page

    1. Create registration.php file at app\code\Vendor\Module and use the below code.
    2. Create module.xml file at app\code\Vendor\Module\etc and paste the below code.

    3. Create customer_index_edit.xml file at app/code/Vendor/Module/view/adminhtml and use the below code.
    4. Create Custom.php file at app/code/Vendor/Module/Block/Adminhtml/Edit/Tab directory.
    5. Create module_index_custom.xml at app/code/Vendor/Module/view/adminhtml directory.
    6. Create Custom.php at app/code/Vendor/Module/Block/Adminhtml/Edit/Tab/View directory.

The display will be look like as shown below.

How to Create a Tab And Load Grid in Magento 2 Customer Admin Edit Page

The custom tab is created in the customer information section and the custom grid is now displayed with loading data from the table using the above solution.

That’s it.

Any doubts? Do mention them in the Comments section below.

I would be glad to help you out.

Also, please share the solution with Magento Community via social media.

Thank you.

(based on 14 Reviews)
How to Create a Tab and Load Grid in Magento 2 Customer Admin Edit Page

Kanchi Upadhyay

Kanchi is a Magento Developer at Meetanshi. Apart from that, she is into dancing. In her free time, she likes to make handmade art and craft.


  • Rupesh

    Can u give this “Vendor\Module\Model\ResourceModel\ModuleName\CollectionFactory;”
    its not working with custom table i have created.. Getting Failed to load resource: the server responded with a status of 404 (Not Found)

    • Sanjay Jethva

      Hello Rupesh,
      If the gettabURL in the Custom.php is not proper then the issue may arrive:
      public function getTabUrl()
      return $this->getUrl(‘module/*/custom’, [‘_current’ => true]);
      Thank You

Leave a Reply

Your email address will not be published. Required fields are marked *