How to remove the Create Order button from customer admin form in Magento 2
In Magento 2, there is an app/code/Magento/Customer/view/base/ui_component/customer_form.xml file with array of buttons. Create Order Button is also there:
1 |
<item name="order" xsi:type="string">Magento\Customer\Block\Adminhtml\Edit\OrderButton</item> |
Remove the item from an array and the form will be rendered without “Create Order” button. In a custom module customer_form.xml file has to be prepared.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> ... <item name="buttons" xsi:type="array"> <item name="back" xsi:type="string">Magento\Customer\Block\Adminhtml\Edit\BackButton</item> <item name="delete" xsi:type="string">Magento\Customer\Block\Adminhtml\Edit\DeleteButton</item> <item name="invalidateToken" xsi:type="string">Magento\Customer\Block\Adminhtml\Edit\InvalidateTokenButton</item> <item name="resetPassword" xsi:type="string">Magento\Customer\Block\Adminhtml\Edit\ResetPasswordButton</item> <item name="reset" xsi:type="string">Magento\Customer\Block\Adminhtml\Edit\ResetButton</item> <item name="save" xsi:type="string">Magento\Customer\Block\Adminhtml\Edit\SaveButton</item> <item name="save_and_continue" xsi:type="string">Magento\Customer\Block\Adminhtml\Edit\SaveAndContinueButton</item> </item> ... </argument> |
Source: