enter image description here

I want the VAT number filed on to present when i click the user to zero vat customer group.If click any other group i dont want to show the vat field. Anyone has any idea how to fix this.


this is the core file for this

1 Answer 1


Hide Tax/Vat Number Field from customer admin form based on Customer Group.

You can hide Tax/Vat Number field and only show based on specific selected group like 1

You can change group value as you want show/hide on Tax/Vat Number field.

Follow below steps:

File path: magento/app/code/Vendor/CustomerForm/registration.php



File path: magento/app/code/Vendor/CustomerForm/etc/module.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_CustomerForm" setup_version="1.0.0">
            <module name="Magento_Customer"/>

File path: magento/app/code/Vendor/CustomerForm/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="customer">
            <label translate="true">Account Information</label>
        <container name="container_group" component="Magento_Ui/js/form/components/group" sortOrder="20">
            <argument name="data" xsi:type="array">
                <item name="type" xsi:type="string">group</item>
                <item name="config" xsi:type="array">
                    <item name="label" xsi:type="string" translate="true">Group</item>
                    <item name="required" xsi:type="boolean">true</item>
                    <item name="dataScope" xsi:type="boolean">false</item>
                    <item name="validateWholeGroup" xsi:type="boolean">true</item>
            <field name="group_id" formElement="select">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="fieldGroup" xsi:type="string">group_id</item>
                        <item name="component" xsi:type="string">Vendor_CustomerForm/js/customer</item>
                        <item name="source" xsi:type="string">customer</item>
        <field name="taxvat" formElement="input">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="source" xsi:type="string">customer</item>
                <rule name="required-entry" xsi:type="boolean">true</rule>

File path: magento/app/code/Vendor/CustomerForm/view/adminhtml/web/js/customer.js

], function (_, uiRegistry, select, modal) {
    'use strict';

    return select.extend({
        onUpdate: function (value) {

            var taxvat = uiRegistry.get('index = taxvat');
            if(value == 1) {
            } else {
            return this._super();

Try this above code and let me know if any issue.

Hope it help!

  • I want the VAT number filed on to present when i click the user to zero vat customer group. How can i do that @kirti nariya Commented Nov 21, 2018 at 11:55
  • It didnt work it just removes the Tax/Vat filed from all Groups. I wanted to show the field only when i chose Group = zero vat customer group Commented Nov 21, 2018 at 12:03
  • @Jibin george you can check this link for hide / show filed in admin magento.stackexchange.com/questions/45819/… Commented Nov 21, 2018 at 13:02
  • That page didn't help much, I need to change the ui_component. at the the code you have provided here i tried that and that only hides the field for all groups i need to hide it just for one specific group Commented Nov 21, 2018 at 13:30
  • @jibingeorge Please check my update my answer. Commented Nov 26, 2018 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.