Magento – Hide or remove column from sales order grid

layoutlayout-updatemagento2sales-ordersales-order-grid

I want to hide or remove Purchase Point column from sales order grid in backend using custom module, how do i do this?

enter image description here

Best Answer

You need to override the layout for sales order grid, in order to do this create the sales order grid layout file inside your custom module

Namespace/Module/view/adminhtml/ui_component/sales_order_grid.xml

To hide element in this grid you have to set componentDisabled item argument to true , you'll also need to disable purchase point filter if you want to hide purchase point column. So the sales_order_grid.xml will look like this:

<?xml version="1.0" encoding="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">
        <filters name="listing_filters">
            <filterSelect name="store_id" provider="${ $.parentName }">
              <argument name="data" xsi:type="array">
                  <item name="config" xsi:type="array">
                      <item name="componentDisabled" xsi:type="boolean">true</item>
                  </item>
              </argument>
            </filterSelect>
        </filters>
    </listingToolbar>
    <columns name="sales_order_columns">
        <column name="store_id" class="Magento\Ui\Component\Listing\Columns\Date">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="componentDisabled" xsi:type="boolean">true</item>
                </item>
            </argument>
        </column>
    </columns>
</listing>
Related Topic