I have a UI component defining field, I want to display this field while edit existing product, and hide this field when add new product.


<fieldset name="vendorproduct">  
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="label" xsi:type="string" translate="true">Seller Sell This Product</item>
            <item name="collapsible" xsi:type="boolean">true</item>
            <item name="sortOrder" xsi:type="number">65</item>
    <container name="vendor_data" >
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="sortOrder" xsi:type="number">10</item>
        <htmlContent name="html_content">
            <argument name="block" xsi:type="object">Namespace\Modulename\Block\Adminhtml\Catalog\Product\Edit\Tab\Seller</argument>

Using <item name="disabled" xsi:type="boolean">true</item> I can disable fields but I want to disable them while adding new product only. how can I achieve this.

Any help is appreciated. Thanks.

 <virtualType name="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Pool">
        <argument name="modifiers" xsi:type="array">
            <item name="name" xsi:type="array">
                <item name="class" xsi:type="string">Namespace\ModuleNam\Ui\DataProvider\Product\Form\Modifier\Attributes</item>
                <item name="sortOrder" xsi:type="number">1000</item>


public function modifyMeta(array $meta)
    // check to disable attributes on product new
    if ($this->lumaData->getGeneralConfig('lockattributes') == 1) {
        // attributes need to be disabled
        $attributes = array();
    } else {

    $attributes = array();
    if ($this->httpRequest->getActionName() == 'new' ) {                       
        // code to make the attribute disable
        foreach($attributes as $attribute){

            $path = $this->arrayManager->findPath($attribute, $meta, null, 'children');
            if ($path) {
                $meta = $this->arrayManager->set(
    return $meta;
If you use this you will get solution

According to the official docs Modifier classes should be used when you need to add validations to display only certain fields for certain product types and also when static declaration is not applicable. Which I think is the case you are describing here.


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.