I want to hide or remove Purchase Point column from sales order grid in backend using custom module, how do i do this?
2 Answers
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>
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
-
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... facepalmapp/code/Vendor/Module/view/adminhtml/ui_component/sales_order_grid.xml
– PromIncCommented Dec 1, 2022 at 16:48 -