How to add New Tab in to Customer Form in Backend Magento 2

I observe that some extensions want to include a new tab in to customer form to exhibits more information. Here we try to do it. Magento 2 uses UI element and it is easy to change the content on the page by editing UI component file. Customer form page uses the file customer_form.xml. So you can built new file customer_form.xml in your extension like
app\code\Webnexs\InventorySuccess\view\adminhtml\ui_component\customer_form.xml :

<?xml version="1.0" encoding="UTF-8"?>

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">

   <fieldset name="test">

       <argument name="data" xsi:type="array">

           <item name="config" xsi:type="array">

               <item name="label" xsi:type="string" translate="true">Reward Account</item>

               <item name="sort_order" xsi:type="string">1</item>

           </item>

       </argument>

       <field name="enable">

           <argument name="data" xsi:type="array">

               <item name="config" xsi:type="array">

                   <item name="dataType" xsi:type="string">text</item>

                   <item name="formElement" xsi:type="string">select</item>

                   <item name="label" xsi:type="string">Customer</item>

                   <item name="options" xsi:type="array">

                       <item name="20" xsi:type="array">

                           <item name="value" xsi:type="number">1</item>

                           <item name="label" xsi:type="string" translate="true">Yes</item>

                       </item>

                       <item name="30" xsi:type="array">

                           <item name="value" xsi:type="number">0</item>

                           <item name="label" xsi:type="string" translate="true">No</item>

                       </item>

                   </item>

               </item>

           </argument>

       </field>

   </fieldset>

</form>

When the page is delivered, it will receive content from all the files in the name Customer_form.xml. So this will show the tab as a “Reward Account” in the customer form like my image.

customer form in backend magento 2

The above mentioned steps help you to add New Tab to Customer Form in Backend Magento 2

Last Update: April 7, 2018  

March 12, 2018   364   Nandini Ramachandran    Operations    
Total 1 Votes:
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Reply

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

Facebook
Twitter
INSTAGRAM
LinkedIn