Remove button from customer admin form in Magento 2

After test I think it work with Magento\Customer\Block\Adminhtml\Edit\OrderButton and not Magento\Customer\Block\Adminhtml\Edit it has public function:

public function getButtonData()
{
    $customerId = $this->getCustomerId();
    $data = [];
    if ($customerId && $this->authorization->isAllowed('Magento_Sales::create')) {
        $data = [
            'label' => __('Create Order'),
            'on_click' => sprintf("location.href = '%s';", $this->getCreateOrderUrl()),
            'class' => 'add',
            'sort_order' => 40,
        ];
    }
    return $data;
}

you can use plugin is public function


There is no need to write plugin for class which is configured via UI Component configuration file.

There is a app/code/Magento/Customer/view/base/ui_component/customer_form.xml file with array of buttons including Create Order Buton:

 <item name="order" xsi:type="string">Magento\Customer\Block\Adminhtml\Edit\OrderButton</item>

In case this item is removed from an array the form will be rendered without "Create Order" button. In your custom module customer_form.xml file has to be prepared.

    <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>

You can easily remove one of the buttons added into vendor/magento/module-customer/view/base/ui_component/customer_form.xml, declaring a new customer_form.xml file into a custom module with the following path:

app/code/VendorName/ModuleName/view/base/ui_component/customer_form.xml

and the content will be:

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