The admin grids in Magento 2 backend are an easy way to manage data, sort, edit, filter, or delete it.
The admin grids are well-equipped with mass actions such as Cancel, Print, Delete, etc.
The default Magento 2 order grid mass action looks something like this:
However, increasing business innovations and urgency to complete the task lists have compelled the developers to customize the admin grids and add mass actions to get things done quickly.
Talking about the standard Magento 2 order grid, it’s mass actions is pretty much enough for basic order management tasks. But we are not satisfied with the basics, are we!
Therefore, I’ve come up with a programmatic solution to add custom mass action in order grid in Magento 2.
Adding custom mass action in Magento 2 order grid will allow the store admins to:
- Process orders efficiently
- Convenience in order management
- More work, less time
- Less dependency on the developers
Using Magento 2 UI components, one can add new mass action to the existing order grid in Magento 2 as shown below:
Method to Add Custom Mass Action in Order Grid in Magento 2:
Create sales_order_grid.xml file at app\code\Vendor\Extension\view\adminhtml\ui_component\
<?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">
<massaction name="listing_massaction" component="Magento_Ui/js/grid/tree-massactions">
<label translate="true">New Action</label>
It is an example to add “Print Order Preparation” mass action in the order grid as shown below:
You can refer the same for adding custom mass actions to order grid as per your Magento 2 project requirements!
Meanwhile, you can use the Comments section below if you have any doubts. I’d be happy to help you out.
Also, do share this useful solution with Magento 2 store admins and developers via social media.