How to Add Custom Mass Action in Customer Grid in Magento 2
Backend grids in Magento 2 are meant for easy data management.
The mass actions in the admin panel grids allow the admin to perform an action in bulk.
The default customer grid offers multiple mass actions:
However, modern business may demand custom actions to be performed on customer data.
Today, I’ll show the programmatic solution to add custom mass action in the customer grid in Magento 2.
One can use this solution to confirm the registration of customers in bulk or update customers’ data at a time.
The default Magento 2 does not have this feature. Therefore, here, I have shared a programmatic solution as shown below:
Method to Add Custom Mass Action in the Customer Grid in Magento 2
Here is what you need to do.
Create file customer_listing.xml at app\code\Vendor\Extension\view\adminhtml\ui_component\
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<?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"> <listingToolbar name="listing_top"> <massaction name="listing_massaction"> <action name="custommassaction"> <settings> <confirm> <message translate="true">Are you sure to perform Action for selected customers?</message> <title translate="true">Custom MassAction</title> </confirm> <url path="extension/controller/massAction"/> <!-- your custom controller to handle request --> <type>custommassaction</type> <label translate="true">Custom MassAction</label> </settings> </action> </massaction> </listingToolbar> </listing> |
After executing this code, you manage to add custom mass action in the customer grid.
That’s it.
If you have queries regarding this post, feel free to ask in the Comment section below.
I would be happy to answer your question.
Share this post to Magento Community via social media to bring more awareness about adding custom mass action in the customer grid.
Thank you.
Related Posts:
- How to Add Mass Custom Action in Order Grid in Magento 2
- How to Add Custom Mass Action to Product Grid In Magento 2
Prev
How to Add Custom Mass Action to Product Grid In Magento 2
How to Add Dynamic Field in Magento 2 Admin Using system.xml
Next