How To Add Custom Mass Action In Customer Grid In Magento 2

Hello Everyone,

In this blog, we will learn about how to add Custom Mass Action in Customer Grid in Magento 2.

Without wasting your time, let us guide you straight away. Follow the easy step given below to Add Custom Mass Action in Customer Grid in Magento 2.

STEPS FOR ADD CUSTOM MASS ACTION IN CUSTOMER GRID IN MAGENTO 2

Step 1: Create customer_listing.xml file

app/code/Vendor/Extension/view/adminhtml/ui_component/customer_listing.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">

    <listingToolbar name="listing_top">

        <massaction name="listing_massaction">

            <action name="sendemail">

                <settings>

                    <confirm>

                        <message translate="true">Are you sure you want to send Mail to selected customers?</message>

                        <title translate="true">Send Mail</title>

                    </confirm>

                    <url path="modulename/index/massAction"/> <!-- your custom controller to handle request -->

                    <type>sendemail</type>

                    <label translate="true">Send Mail</label>

                </settings>

            </action>

        </massaction>

    </listingToolbar>

</listing>

Step 2: Finally run the below commands

$ php bin/magento cache:clean

$ php bin/magento cache:flush

Step 3: Output:

Final Thoughts:

So this was the easiest way which we have told you in this blog. This is how you can Add Custom Mass Action in Customer Grid in Magento 2. Hope you liked the blog.

So quickly go to the comment box and tell me how you like this blog?

Stay tuned with us on our site to get new updates of Magento.

Thanks for reading and visiting our site.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Leave a Reply

Your email address will not be published. Required fields are marked *