Bulk Actions reference

You can define actions for every selected rows of your grid. PrestaShop already comes with a list of common bulk actions that you can use in your own Grids.

SubmitBulkAction

This action will submit the data of your rows into a specific route.

Properties Expected value(s)
Type submit
Requirements submit_route
Defaults confirm_message => null
submit_method => “POST”
Allowed Types submit_route (string)
confirm_message (string or null)
Allowed Values submit_method (“POST” or “GET”)

DeleteCategoriesBulkAction

This action will delete the selected Categories in Catalog > Categories page.

Properties Expected value(s)
Type delete_categories
Requirements categories_bulk_delete_route
Allowed Types submitcategories_bulk_delete_route_route (string)

DeleteCustomersBulkAction

This bulk action will delete the selected Customers in Sell > Customers page.

Properties Expected value(s)
Type delete_customers
Requirements customers_bulk_delete_route
Allowed Types customers_bulk_delete_route (string)

Use case exemple

<?php
// /modules/my-module/src/Grid/MyGridDefinitionFactory.php
namespace MyModule\Grid;

use PrestaShop\PrestaShop\Core\Grid\Definition\Factory\AbstractGridDefinitionFactory;
use PrestaShop\PrestaShop\Core\Grid\Action\Bulk\Type\SubmitBulkAction;
use PrestaShop\PrestaShop\Core\Grid\Action\Bulk\BulkActionCollection;

/**
 * How to define the Grid bulk actions?
 * You can adapt this exemple or look at the existing ones
 * in PrestaShop Core.
 */
class MyGridDefinitionFactory extends AbstractGridDefinition
{
    /**
     * {@inheritdoc}
     */
    protected function getBulkActions()
    {
        return (new BulkActionCollection())
            ->add(
                (new SubmitBulkAction('enable_selection'))
                ->setName('Enable selection')
                ->setOptions([
                    'submit_route' => 'submit_stuff',
                ])
            )
        ;
    }
}
You need to create a custom Bulk Action? We got you covered!