Override sales_order_grid.xml to remove print options from mass action drop down in sales orders

magento.stackexchange https://magento.stackexchange.com/questions/336176

سؤال

Hello everyone,

I'm trying to override the file sales_order_grid.xml to remove some print options from the mass action drop down in sales orders. I'm using Magento 2.4.2.

The original file is located here:

\vendor\magento\module-sales\view\adminhtml\ui_component\sales_order_grid.xml
  1. Where should I put the file to override it?
  2. Do I need to to create a module?
  3. Can I just make a copy of the file somewhere in my custom theme?

Thank you very much,

هل كانت مفيدة؟

المحلول

You have to do in your custom module. Please follow below steps.

Step 1: In your custom module's module.xml file you have to write below code. Path :- PackageName/Module/etc/module.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="PackageName_Module" setup_version="1.0.0">
        <sequence>
            <module name="Magento_Sales" />
        </sequence>
    </module>
</config>

Step 2: Create file sales_order_grid.xml file under PackageName/Module/view/adminhtml/ui_component/

<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<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="pdfinvoices_order">
                <settings>
                    <url path="sales/order/pdfinvoices"/>
                    <type>pdfinvoices_order</type>
                    <label translate="true">Print Invoices</label>
                    <actionDisable>true</actionDisable>
                </settings>
            </action>
            <action name="pdfshipments_order">
                <settings>
                    <url path="sales/order/pdfshipments"/>
                    <type>pdfshipments_order</type>
                    <label translate="true">Print Packing Slips</label>
                    <actionDisable>true</actionDisable>
                </settings>
            </action>
            <action name="pdfcreditmemos_order">
                <settings>
                    <url path="sales/order/pdfcreditmemos"/>
                    <type>pdfcreditmemos_order</type>
                    <label translate="true">Print Credit Memos</label>
                    <actionDisable>true</actionDisable>
                </settings>
            </action>
            <action name="pdfdocs_order">
                <settings>
                    <url path="sales/order/pdfdocs"/>
                    <type>pdfdocs_order</type>
                    <label translate="true">Print All</label>
                    <actionDisable>true</actionDisable>
                </settings>
            </action>
            <action name="print_shipping_label">
                <settings>
                    <url path="adminhtml/order_shipment/massPrintShippingLabel"/>
                    <type>print_shipping_label</type>
                    <label translate="true">Print Shipping Labels</label>
                    <actionDisable>true</actionDisable>
                </settings>
            </action>
        </massaction>
    </listingToolbar>
</listing>

As per above code you can remove all print actions from mass actions from sales > orders gird.

Output will be in my case :- https://prnt.sc/122pzpl

Please check and let me know if you have any query.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top