Learn how to add a new tab into customer form in backend Magento 2 in a few steps.
I observe that some extensions want to include a new tab into customer form to exhibits more information. Here we try to do it. Magento 2 uses UI elements, and it is easy to change the content on the page by editing the UI component file.
Build your Amazon-like multi-vendor marketplace website @ $249/- now!!!
Get your free live demo now: Click here
How to add New Tab into the Customer Form in Backend Magento 2?
The customer form page uses the file customer_form.xml. So you can build 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.
The above-mentioned steps help you to add a New Tab to the Customer Form in the Backend Magento platform.
Build your online store with Magento 2 platform here today!!!
Leave a Reply