Menu Close
    Hire us Request quote Reading list Switch to dark mode

    Add custom columns to Order Grid in Admin Magento 2

    We will learn how to add your custom columns to Order Grid in Admin without adding columns to sales_order_grid table in Database.

    Firstly, we will create Order listing UI component instance. The original file for rendering the Product Grid is Magento_Catalog/view/adminhtml/ui_component/sales_order_grid.xml

    Create a file with same name and path in your module.

    app/code/[Vendor]/[Module_Name]/view/adminhtml/ui_component/sales_order_grid.xml


    Now, create a plugin for Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory

    Doing this there will be no dependency on rewrites and it will make the lean.


    Next step is to create the Plugin folder and Plugin class in the module.

    app/code/[Vendor]/[Module_Name]/Plugin/SalesOrderCustomColumn.php

    . . .

    Comments (2)

    Add Your Comment

  • Umer
    is it possible if a column is not exist in any table column and then apply filter ?
    • Sagar Bathla
      Hi Umer,
      Yes you can use the above snippet for implementing the filter.
  • Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again
    Close