How to Add a Custom Column in Order Grid in Magento 2

How to Add a Custom Column in Order Grid in Magento 2

The default Magento 2 sales order grid offers a number of columns to easily manage the order processing. However, with the advancing E-commerce options and the majority of preference for online shopping, more data is to be handled, for which, the default order grid may not be enough.

The smooth order process is essential when it comes to customer experience. If the store can handle the order delivery fast and accurate, the customers are prompted to repeat their choice for the next purchase too!

However, it is possible only when the admin can systematically handle the order data. All the data accessible in one place can make it easier. For that, the admin may need to add a custom column in order grid in Magento 2 store which is not offered by default.

The programmatic method to add a custom column in the sales order grid in Magento 2 store is given in the post.

However, you can also opt for easy solution, the Magento 2 Custom Order Grid extension that allows adding 50+ custom columns in the order grid for the easy and accurate order processing system.

Method to add a custom column in order grid in Magento 2 ​​​​​​:

  1. Create di.xml file at app\code\Vendor\Module\etc\ with following code:
  2. Create Collection.php file at app\code\Vendor\Module\Model\ResourceModel\Order\Grid\ with the following code:
  3. Create sales_order_grid.xml file app\code\Vendor\Module\view\adminhtml\ui_component\ with following code:

That’s it.

Feel free to mention your doubts in the Comments section below, if any, and I’d be happy to help.

Please share the above solution with fellow developers on social media.

Thanks.
CTA_M2-Custom-Order-Grid

5
(based on 6 Reviews)

Sanjay is a co-founder at Meetanshi. He is a certified Magento developer who loves creating Magento E-commerce solutions. When he is not engrossed with anything related to Magento, he loves to play cricket.

Leave a Reply