2

which files should I edit to remove the delete option at action drop-down menu? I've tried to remove

 $this->getMassactionBlock()->addItem(
            'delete',
            [
                'label' => __('Delete'),
                'url' => $this->getUrl('catalog/*/massDelete'),
                'confirm' => __('Are you sure?')
            ]
        );

\Magento\Catalog\Block\Adminhtml\Product\Grid.php, but the delete button still appears.

Thanks.

2

Magento 2 used UI Component to render products grid at admin, you can remove delete action at: magento\module-catalog\view\adminhtml\ui_component\product_listing.xml:

comment or remove:

<action name="delete">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="confirm" xsi:type="array">
                        <item name="title" xsi:type="string" translate="true">Delete items</item>
                        <item name="message" xsi:type="string" translate="true">Delete selected items?</item>
                    </item>
                    <item name="type" xsi:type="string">delete</item>
                    <item name="label" xsi:type="string" translate="true">Delete</item>
                    <item name="url" xsi:type="url" path="catalog/product/massDelete"/>
                </item>
            </argument>
        </action>
  • How do you do this outside of the /vendor file - I've tried copying the file in to my app/code module but removing it just means it uses the one inside /vendor? – tim.baker Jan 30 '18 at 11:43
0

I found it! I removed the 'delete' option by editing \Magento\Catalog\view\adminhtml\ui_component\product_listing.xml

\Magento\Catalog\Block\Adminhtml\Product\Grid.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.