🔥 Just Launched! Werra Premium Template for HyväSee it in Action

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

By Kishor ChhuganiUpdated on Jul 17, 2025 3 min read

Backend grids in Magento 2 make the life of store admins easier!

The edit, delete or update actions can be made directly from the grid. Moreover, Magento 2 offers mass action to perform these actions in bulk.

The default product grid in Magento 2 offers mass actions like:

Default Product Grid in Magento 2

However, increasing business demands may not be satisfied with these default mass actions. Hence, you may add custom mass action in product grid in Magento 2.

For example, using a mass action, the admin can update the price or quantity of products in bulk, or generate barcode for products.

Develop your custom code for any such actions with the help of the below solution:

Method to Add Custom Mass Action in Product Grid in Magento 2

What you have to do is.

Create product_listing.xml file at app\code\Vendor\Extension\view\adminhtml\ui_component\

<?xml version="1.0" Programmatic Solutionencoding="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">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="component" xsi:type="string">Magento_Ui/js/grid/tree-massactions</item>
                </item>
            </argument>
            <action name="barcode">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="type" xsi:type="string">massoperation</item>
                        <item name="label" xsi:type="string" translate="true">Custom Mass Action</item>
                        <item name="url" xsi:type="url" path="extension/controller/massaction"/>
                        <item name="confirm" xsi:type="array">
                            <item name="title" xsi:type="string" translate="true">Custom Mass Action</item>
                            <item name="message" xsi:type="string" translate="true">Are you sure want to Perform Custom
                                Action For selected items?
                            </item>
                        </item>
                    </item>
                </argument>
            </action>
        </massaction>
        <paging name="listing_paging"/>
    </listingToolbar>
</listing>

After executing this code, you manage to add custom mass action in the product grid.

Add Custom Mass Action in the Product Grid in Magento 2

Do consider sharing this post to Magento Community via social media.

Thank you.

Related Posts:

Kishor Chhugani Full Image
Article byKishor Chhugani

He is a Magento developer at Meetanshi with a jolly, extrovert, & friendly personality. He loves playing cricket and is a passionate foodie!