Magento2 Add Quote ID in Sales Order Grid

The question:

I am trying to display quote id of an order in the sales order grid. New field is getting displayed in the grid. However the value of the quote id is not getting populated in the grid against each order.

How to show the quote id from the sales. I believe di.xml needs to be added for it work. I am not sure how the di.xml needs to be.

Here is the code viewadminhtmlui_componentsales_order_grid.xml

<listing xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd">
<columns name="sales_order_columns">
    <column name="quote_id">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Quote Id</item>

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Add sequence tag inside module.xml

    <module name="Magento_Sales"/>

Create Vendor/Module/etc/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
            <argument name="collections" xsi:type="array">
                <item name="sales_order_grid_data_source" xsi:type="string">VendorModuleModelResourceModelOrderGridCollection</item>
    <virtualType name="VendorModuleModelResourceModelOrderGridCollection">
            <argument name="mainTable" xsi:type="string">sales_order_grid</argument>
            <argument name="resourceModel" xsi:type="string">MagentoSalesModelResourceModelOrder</argument>

Create Vendor/Module/Model/ResourceModel/Order/Grid/Collection.php

namespace VendorModuleModelResourceModelOrderGrid;

use MagentoFrameworkViewElementUiComponentDataProviderSearchResult;

class Collection extends SearchResult
    protected function _initSelect()
            'main_table.entity_id = '.$this->getTable('sales_order').'.entity_id',

        return $this;

Run following command and clear cache

php bin/magento setup:upgrade

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment