🔥 Just Launched! Werra Premium Template for HyväSee it in Action

How to Include Discount Column in Admin Order Grid without Adding Field in sales_order_grid table in Magento 2

By Sanjay JethvaUpdated on May 22, 2025 3 min read

Order grid in Magento 2 displays the order data. The order grid lists the order data like order ID, purchase date, order amount, customer name who placed the order, grand total, subtotal, payment method, etc.

The order data in grid format makes it easy for the admin to process every order, manage the delivery, and smoothly fulfil each order.

The default sales order grid in the backend facilitates the option to show the selected columns among the default options.

However, owing to modern business requirements, the admin may require to add a custom column in order grid in Magento 2 for better order processing.

Faster and smoother order processing gives a delightful shopping experience. It also reduces the admin’s workload.

One such instance is to add the custom discount column in admin order grid. The admin can easily manage the discounts assigned with each order, analyze the benefits of offering discounts, etc.

The programmatic method to add discount column in admin order grid without adding field in sales_order_grid table in Magento 2 is easy, as shown below:

Method to Include Discount Column in Admin Order Grid Without Adding Field in sales_order_grid Table in Magento 2:

1. Create,

app/code/Meetanshi/DiscountColumn/Model/ResourceModel/Order/Grid/Collection.php

<?php

namespace Meetanshi\DiscountColumn\Model\ResourceModel\Order\Grid;

use Magento\Framework\Data\Collection\Db\FetchStrategyInterface as FetchStrategy;
use Magento\Framework\Data\Collection\EntityFactoryInterface as EntityFactory;
use Magento\Framework\Event\ManagerInterface as EventManager;
use Magento\Sales\Model\ResourceModel\Order\Grid\Collection as OriginalCollection;
use Psr\Log\LoggerInterface as Logger;

/**
 * Order grid extended collection
 */
class Collection extends OriginalCollection
{
    protected $helper;

    public function __construct(
        EntityFactory $entityFactory,
        Logger $logger,
        FetchStrategy $fetchStrategy,
        EventManager $eventManager,
        $mainTable = 'sales_order_grid',
        $resourceModel = \Magento\Sales\Model\ResourceModel\Order::class
    )
    {
        parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $mainTable, $resourceModel);
    }

    protected function _renderFiltersBefore()
    {
        $joinTable = $this->getTable('sales_order');
        $this->getSelect()->joinLeft($joinTable, 'main_table.entity_id = sales_order.entity_id', ['tax_amount', 'discount_amount']);
        parent::_renderFiltersBefore();
    }
}

2. Create,

/app/code/Meetanshi/DiscountColumn/etc/di.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="sales_order_grid_data_source" xsi:type="string">Meetanshi\DiscountColumn\Model\ResourceModel\Order\Grid\Collection</item>
            </argument>
        </arguments>
    </type>
    <type name="Meetanshi\DiscountColumn\Model\ResourceModel\Order\Grid\Collection">
        <arguments>
            <argument name="mainTable" xsi:type="string">sales_order_grid</argument>
            <argument name="resourceModel" xsi:type="string">Magento\Sales\Model\ResourceModel\Order</argument>
        </arguments>
    </type>
</config>

3. Create,

/app/code/Meetanshi/DiscountColumn/etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Meetanshi_DiscountColumn" setup_version="1.0.0"/>
</config>

4. Create,

/app/code/Meetanshi/DiscountColumn/view/adminhtml/ui_component/sales_order_grid.xml

<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="sales_order_columns">
        <column name="tax_amount" class="Magento\Sales\Ui\Component\Listing\Column\PurchasedPrice">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Tax</item>
                </item>
            </argument>
        </column>
        <column name="discount_amount" class="Magento\Sales\Ui\Component\Listing\Column\PurchasedPrice">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="label" xsi:type="string" translate="true">Discount</item>
                </item>
            </argument>
        </column>
    </columns>
</listing>

5. Create,

app/code/Meetanshi/DiscountColumn/registration.php/

<?php
use \Magento\Framework\Component\ComponentRegistrar;

ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Meetanshi_DiscountColumn', __DIR__);

You can download the extension from our Github or implement the steps as below:

That’s it.

Once done, you can see the discount column in order grid:

Discount Column in Admin Order Grid in Magento 2

Also, do share the post with the Magento community via social media.

Thank you.

Sanjay Jethva Full Image
Article bySanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.