I have added a Column to the New Order -> Customer Grid. I am having a really tough time getting the system config to disable this code if turned off. I was hoping I could use a simple ifconfig in the sales_order_create_customer_block.xml or the di.xml to check but it does not work. I have tried calling isNewOrderCustomerGridEnabled() as an if before but I get a cannot be null error.

In the other grids, I added the column with a Plugin and the ui_component xml. Which I was able to add a specific class Ui/Component/Listing/Column/Company.php which checks the Data.php and displays the information depending on the system config setting.

Here is some of the code. Please let me know if you need any more information.


<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceBlock name="adminhtml.customer.grid.container">
            <argument name="dataSource" xsi:type="object">Trucatch\CompanyColumn\Model\ResourceModel\Order\Customer\Collection</argument>
        <referenceBlock name="adminhtml.customer.grid.columnSet">
            <block class="Magento\Backend\Block\Widget\Grid\Column" as="billing_company" after="name">
                    <argument name="header" xsi:type="string" translate="true">Company</argument>
                    <argument name="index" xsi:type="string">billing_company</argument>


<preference for="Magento\Sales\Model\ResourceModel\Order\Customer\Collection" type="Trucatch\CompanyColumn\Model\ResourceModel\Order\Customer\Collection"/>


const CONFIG_PATH_GENERAL_NEW_ORDER_CUSTOMER_GRID = 'companycolumn/general/new_order_customer_grid_enabled';

public function isNewOrderCustomerGridEnabled()
    return $this->scopeConfig->getValue(


protected function _initSelect()
    return $this;


Your Answer

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