0

I want to override the below file

vendor/magento/module-customer/view/base/ui_component/customer_form.xml

I have copied that file to the specific location and made the changes.

app/code/[vendor]/[module]/view/base/ui_component/customer_form.xml

Also tried with below location

app/code/[vendor]/[module]/view/adminhtml/ui_component/customer_form.xml

But still, my changes do not reflect.

I just want to modify content in my ui_component file.

<field name="sendemail_store_id">
        <argument name="data" xsi:type="array">
            <item name="options" xsi:type="object">Magento\Store\Model\System\Store</item>
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Send Welcome Email From</item>
                <item name="dataType" xsi:type="string">number</item>
                <item name="formElement" xsi:type="string">select</item>
            </item>
        </argument>
    </field>

Please help me if you have any idea. I really appreciate your response.

3

Please refer this question, it is same as your question.

Override base/ui_component/customer_form.xml

In this overridden "lastname" field. So you can change it as per your requirement.

Try placing it in app/code/Vendor/Module/view/adminhtml/ui_component/customer_form.xml with the following content

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="address">
    <field name="lastname">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="validation" xsi:type="array">
                    <!-- this should work but doesn't appear to, needed to do a core hack instead -->
                    <item name="required-entry" xsi:type="boolean">false</item>
                </item>
            </item>
        </argument>
    </field>
</fieldset>

| improve this answer | |
2

I got the answer to my question.

My way is correct and I just forgot to remove cache because my store is in production mode.

Just simply create below file in your specific module and that module must be enabled

app/code/[vendor]/[module]/view/base/ui_component/customer_form.xml

and Just past the specific field which you want to override

Example:

<?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">
    <field name="sendemail_store_id">
        <argument name="data" xsi:type="array">
            <item name="options" xsi:type="object">Magento\Store\Model\System\Store</item>
                <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Send Welcome Email From</item>
                <item name="dataType" xsi:type="string">number</item>
                <item name="formElement" xsi:type="string">select</item>
                <item name="source" xsi:type="string">customer</item>
                <item name="imports" xsi:type="array">
                    <item name="value" xsi:type="string">${ $.provider }:data.customer.store_id</item>
                </item>
            </item>
        </argument>
    </field>
</fieldset>

| improve this answer | |
  • can i use this to remove custom fields too? – jibin george Feb 12 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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