I have to save value in custom_attribute(current_seller_id) in "sales_order" table. using event below code But now i want to save same value in custom_attribute(current_seller_id) of "sale_order_grid" table. am new in magento guide me which observer or anything used for copy data from sales_order table to sales_order_grid.

  public function execute(\Magento\Framework\Event\Observer $observer)
        $order = $observer->getData('order');
        $quote = $observer->getData('quote');

       // $cartdata=$this->cart->getQuote()->getItemsCollection();
        $quoteItems = $quote->getItems();
        foreach ($quoteItems as $quoteItem){
            if ($quoteItem->getCurrentSellerId() != ""){
        return $this;

1 Answer 1


Try following way will copy data automatically when saving sales_order table:


<?xml version="1.0"?>

    <virtualType name="Magento\Sales\Model\ResourceModel\Order\Grid" type="Magento\Sales\Model\ResourceModel\Grid">
            <argument name="columns" xsi:type="array">
                <item name="current_seller_id" xsi:type="string">sales_order.current_seller_id</item>

More details check this free module

  • Then accept answer, it will help others .
    – Sohel Rana
    Feb 19, 2019 at 18:40

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.