3

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

2 Answers 2

2

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>
1
  • This doesn't work. It only shifts colums.
    – Abid Malik
    Commented Jan 16, 2019 at 13:58
2

The solution should be

<column name="store_id" class="Magento\Store\Ui\Component\Listing\Column\Store">
    <argument name="data" xsi:type="array">
        <item name="disabled" xsi:type="boolean">true</item>
    </argument>
</column>

Based on the vendor/magento/framework/View/Element/UiComponentFactory.php:121

2
  • Thanks!!! This worked like a charm. Make sure you put it in an adminhtml directory... I stupidly wasn't and that tripped me up at first... facepalm app/code/Vendor/Module/view/adminhtml/ui_component/sales_order_grid.xml
    – PromInc
    Commented Dec 1, 2022 at 16:48
  • You are welcome ^^ Commented Dec 1, 2022 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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