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

Hello Everyone,

In this blog, we will learn about how to add Custom Mass Action in Product 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 Product Grid in Magento 2.

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

Step 1: Create product_listing.xml file

app/code/Vendor/Extension/view/adminhtml/ui_component/product_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="custommassaction">

                <settings>

                    <confirm>

                        <message translate="true">Custom Mass Action</message>

                        <title translate="true">Custom Mass Action</title>

                    </confirm>

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

                    <type>custommassaction</type>

                    <label translate="true">Custom Mass Action</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 5 / 5. Vote count: 1

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 *