How can I remove 'Create New Order' button from sales order grid?
I don't want to hide it, i know about following code
<item name="style" xsi:type="string">display:none</item>
Let's assume you have a module in app/code/Vendor/Module
view/adminhtml/ui_component/sales_order_grid.xml
<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<settings>
<buttons>
<button name="add" class="Vendor\Module\Ui\Component\Listing\Buttons\EmptyButton"/>
</buttons>
</settings>
</listing>
Ui/Component/Listing/Buttons/EmptyButton.php
<?php
declare(strict_types=1);
namespace Vendor\Module\Ui\Component\Listing\Buttons;
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface;
class EmptyButton implements ButtonProviderInterface
{
/**
* @return array
*/
public function getButtonData(): array
{
return [];
}
}
Clear the cache, and the "Create New Order" button should be removed.
You can try adding the below instead
<item name="componentDisabled" xsi:type="boolean">true</item>
Try this one:-
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</argument>