trying to save the my oven data in newly added column of sales_order_grid but unable to to do so.

However, I can save my custom the data in sales_order table where I have added one extra column. I am adding the data in sales_order table by getting below observer event.

$obj = $observer->getEvent()->getOrder();

same data is not saving in sales_order_grid table having same column name..

is there there anyway or anything alternative to achieve this???

  • Do you call the save() method when trying to save ? Apr 25, 2016 at 12:16
  • yes, I did but no luck.. as I told you its saving in sales_order table but in sales_order_grid table its not, where column name is same in the both table.. Am i taking wrong event ($observer->getEvent()->getOrder()) ??? Apr 25, 2016 at 12:40

1 Answer 1


Suppose column name 'delivery_date, So that you need to add di.xml for save some value for custom column to grid


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <virtualType name="Magento\Sales\Model\ResourceModel\Order\Grid" type="Magento\Sales\Model\ResourceModel\Grid">
            <argument name="columns" xsi:type="array">
                <item name="delivery_date" xsi:type="string">sales_order.delivery_date</item>

Here is an example

  • Thanks a lot @Sohel Rana, I spend so much time to achieve this, you saved my time, thanks again.. However, I used different event (sales_order_place_after) Apr 27, 2016 at 12:03
  • I have found you must run bin/magento setup:di:compile afterwards, then it starts to populate the grid column from the source table on insert/update.
    – SlimDeluxe
    Nov 24, 2017 at 10:38
  • Sir how can custom value save in custom_column in sales_order_grid table without populate from sales_order to sales_order_grid like your answer because my values are not in sales_order table ? i am using observer sales_model_service_quote_submit_before and now want to save value using model or have service contract for sales_order_grid ?
    – HaFiz Umer
    Oct 2, 2019 at 8:04

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.