June 4, 2020 Yogesh Khasturi

How to Add Custom Column in Sales Order Grid of Magento 2

In this post, we will learn how to add a custom column in sales order grid in Magento 2.

In Magento 2 store owner has the necessity of getting extra information like customer comments. But just receiving such information and saving it into the database is not helpful. Because all time you need to navigate in backend order details views to see selected information. Instead, adding one extra column in Backend Sales Order Grid will help you to have quick look at all useful information.

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

Firstly, we need to create a “sales_order_grid.xml” file at this path using the below code.
app\code\Webiators\OrderColumn\view\adminhtml\ui_component\

Now you have to create one more file “Mycolumn.php” at the following location.
app\code\Webiators\OrderColumn\Ui\Component\Listing\Column\

That’s it

If you are facing any issue while implementing this code feel free to mention them in the Comments section below.