How to add custom column in sales order Grid Magento2?

How to add custom column in sales order Grid Magento2?

To add a new Magento 2 column to the order grid, you need to create and register a custom module. Then, create the Resource Model using the _renderFiltersBefore method. After this, you need to develop a UI component. The detailed step-by-step guide with code examples you can find in the article below.

How do I merge two tables in magento2?

How to Join 2 Tables in Magento 2

  1. Step 1: Set a Collection class that extends.
  2. Step 2: Set your own function to get data.
  3. Step 3: Get the collection and call to filterOrder function above.
  4. Step 4: Save.

How to customise sales order grid in Magento 2?

My findings are, there are no such events in Magento 2. A general event core_collection_abstract_load_after or core_collection_abstract_load_before dispatch to render all of the grids in Magento 2 Admin. We can override _renderFiltersBefore () function to add a column in sales order grid or to join table with sales_order_grid.

How to join two tables in Magento 2?

In order to make you do that with ease, the developer team from Mageplaza recommend the topic Join Data Between 2 Tables in Magento 2. In this topic, I will guide you how to get all orders that created with a specify payment method such as “Check Money Order”.

How to add a new column to orders grid?

Sample setup code to add a column to sales_order_grid table (use this in your install/upgrade script). The same code works for the sales_order table by the way. Hope it helps! 🙂 For creating a new column in order grid , I have referred Magento Default Module vendor/magento/module-customer-balance

Is there any such event like in Magento 1?

In Magento 1 we have sales_order_grid_collection_load_before, sales_order_grid_collection_load_after for this requirement . Is tried to such event for Magento 2 but didn’t get any success. Is there any such event like ( sales_order_grid_collection_load_after) in magento 1 which full fill my requirement?