Thanks! for view this post.

I just want to know if there is any feasibility in which we can add extra columns in grid using extension attributes?

Please share your steps with me.


2 Answers 2


It is possible to use extension attributes bei creating a Plugin for the grid collection. (see paypal/braintree module, which uses also an extension-attribute-table for the sales grid)


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <!-- Sale order grid -->
    <type name="Magento\Sales\Model\ResourceModel\Order\Grid\Collection">
        <plugin name="DrSalesOrderGrid" type="\Dr\Sales\Plugin\SalesOrderGridPlugin" />



namespace Dr\Sales\Plugin;
use Magento\Framework\Exception\LocalizedException;
use Magento\Sales\Model\ResourceModel\Order\Grid\Collection;

class SalesOrderGridPlugin
     * @param Collection $subject
     * @return null
     * @throws LocalizedException
    public function beforeLoad(Collection $subject)
        if (!$subject->isLoaded()) {
            $primaryKey = $subject->getResource()->getIdFieldName();
            $tableName = $subject->getResource()->getTable('dr_sales_order_extension');

                $tableName . '.sales_order_id = main_table.' . $primaryKey,
                $tableName . '.dr_deliverydate'

        return null;


<?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">
    <columns name="sales_order_columns">
        <column name="dr_deliverydate">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">date</item>
                    <item name="label" xsi:type="string" translate="true">Lieferdatum</item>


<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <table name="sales_order">
        <column xsi:type="int"
                comment="Custom Column Id"/>

Thank you

  • Hi @Nirav, Thanks for your response.
    – Rajan Soni
    Commented May 19, 2020 at 10:38
  • Yes, Using extension attributes we can add the custom attribute to the entity. Using the extension attribute I get the custom attribute in order object in API now I want if I add the column in sales order using XML then that field will automatically take the value from my extension attribute. Does It makes sense?
    – Rajan Soni
    Commented May 19, 2020 at 10:42
  • If your custom attribute is custom column of flat table then you only need to add column in listing ui component xml file. otherwise you need to modify dataprovider also as described in last link I shared in answer. you can check it for more details. Commented May 20, 2020 at 4:26

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.