i have added a Custom Attribute in sales_order_grid table now I want to get a record from sales_order_grid by entity_id. Is there any model that I can use easily o inject and get sales_order_grid Data in Magento 2


1 Answer 1


within the file vendor/magento/module-sales/etc/di.xml, I extract a small part of it:

enter image description here

this describes the grid component pulls its data using the model: Magento\Sales\Model\ResourceModel\Order\Grid\Collection.

So my answer would be to pull the order like the grid does to use this resource Model. Now, if you do need only order data given an entity id, the recommended way is to use the sales order repository, and that is \Magento\Sales\Model\OrderRepository

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.