0

enter image description here

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>

3 Answers 3

1

Let's assume you have a module in app/code/Vendor/Module

  1. Create an XML file 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>
  1. Create the Ui Component class 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.

enter image description here

0

You can try adding the below instead

<item name="componentDisabled" xsi:type="boolean">true</item>
0

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.