Removing delete mass action from product grid

Removing delete mass action from product grid

One of our customers asked us to remove the delete option from the mass action element for the product grid. What sounded like a simple task evolved into a lot of debugging and testing. Apparently removing the mass action option from the xml configuration does not work even though a lot of StackOverflow posts say so. The only way that worked for me, was to do it programmatically like this:

Extend the default Product Grid, overwrite the _prepareMassaction() method and remove the delete option there:


namespace Vendor\Product\Block\Adminhtml\Product;

class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid
    protected function _prepareMassaction()

After that the DI configuration needs to modified as well, making sure Magento will use our implementation instead of the default one:

<?xml version="1.0"?>
<config xmlns:xsi=""

    <preference for="Magento\Catalog\Block\Adminhtml\Product\Grid"

Eintrag von Stephan Hochdörfer am 27.03.2019

Tags: Magento, Magento2

Diese Webseite verwendet Cookies, um die Bedienfreundlichkeit zu erhöhen. Mit der Nutzung unserer Webseite wird das Einverständnis erklärt, dass wir Cookies verwenden. Weitere Informationen.