phpmagento2uicomponents

Magento2 Disable component using ui_component


How can i remove the Magento default form ui component. Such as is in the image which is for the Marketing -> cart price rule -> [select already created rule] -> Schedule New Updates

enter image description here

enter image description here

I want to remove the Rule information, Conditions, Actions, Labels Top Banner, After Product Description Banner, Product Label

As you can see it have some extra ui_components as compare to the default Magento EE. It is because of Amasty_Promo module. So i would like to remove it.


Solution

  • For it according to the layout handler create a file in your custom module. In this case it is NameSpace/YourModule/view/adminhtml/ui_component/salesrulestaging_update_form.xml

    with the following content:

    <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
            <item name="componentDisabled" xsi:type="boolean">true</item>
      </item>
    </argument>
    

    such as for rule_information it will be like this:

    <?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="rule_information">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="componentDisabled" xsi:type="boolean">true</item>
                    </item>
                </argument>
            </fieldset>
        </form>
    

    And make sure <argument> will be the first child of the component.