I need to override sales_order_grid.xml to remove some items from the listing_massaction section (The sales order grid mass action menu)
Can anyone point me in the direction?
Hi @miller75
You need to override xml file within your custom module first.
In your custom module, from this path:
vendor\customModule\view\adminhtml\ui_component\sales_order_grid.xml
Add or remove content from xml file:
<?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"> <columns name="sales_order_columns"> <column name="base_grand_total" class="Magento\Sales\Ui\Component\Listing\Column\Price"> <settings> <filter>textRange</filter> <label translate="true">Grand Total (Base)</label> </settings> </column> </columns> </listing>
Run php bin/magento setup:di:compile & php bin/magento setup:static-content:deploy after change within xml file.
It may help you!
Problem Solved? Please click on 'Kudos' & Accept as Solution!
Thanks for the reply, I have tried that but adding it to the custom module just extends the original sales_order_grid.xml so I can add items but not remove them or an I doing something wrong?
I have used the following from https://magento.stackexchange.com/questions/231707/how-to-remove-particular-mass-action-option-from-...
Some items dont work with 'type' so you have yo use 'label'
class MassAction extends \Magento\Ui\Component\MassAction { private $authorization; public function __construct( \Magento\Framework\View\Element\UiComponent\ContextInterface $context, \Magento\Framework\AuthorizationInterface $authorization, array $components, array $data ) { $this->authorization = $authorization; parent::__construct($context, $components, $data); } public function prepare() { parent::prepare(); $config = $this->getConfiguration(); foreach ($config['actions'] as $action) { if (('cancel' != $action['type']) and ('hold_order' != $action['type']) and ('unhold_order' != $action['type']) and ('Print Invoices' != $action['label']) and ('print_shipping_label' != $action['type']) and ('Print Packing Slips' != $action['label']) and ('Print Credit Memos' != $action['label']) and ('Print All' != $action['label'])) { $allowedActions[] = $action; } } $config['actions'] = $allowedActions; $this->setData('config', (array)$config); } }