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

How to Add New Column in Magento 2 Quote Table & Order Table

By Sanjay JethvaUpdated on May 22, 2025 1 min read

Magento 2, no matter how feature-rich, falls short when it comes to meeting the highly customized requirements of clients. Fortunately, the flexible platform allows the developers to modify the code in order to complete the clients’ requirements!

Here, the customization that I’m discussing is to add new column in Magento 2 Quote table & Order table. It can be any column that is not in the default Magento 2 quote table and order table, but the data from the database is needed to be fetched in these tables.

Follow the below method and you get customized Magento 2 quote table and order table!

Method to Add New Column in Magento 2 Quote Table & Order Table:

Create file UpgradeSchema at Vendor/Extension/Setup

<?php
namespace Vendor/Extension/Setup;
use Magento\Framework\Setup\UpgradeSchemaInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;
class UpgradeSchema implements UpgradeSchemaInterface
{
    public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();
        $quoteTable = 'quote';
        $orderTable = 'sales_order';
        //Quote table   
        $setup->getConnection()
            ->addColumn(
                $setup->getTable($quoteTable),
                'fee',
                [
                    'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
                    'length' => '12,4',
                    'default' => 0.00,
                    'nullable' => true,
                    'comment' => 'Extra fee'
                ]
            );
        //Order table
        $setup->getConnection()
            ->addColumn(
                $setup->getTable($orderTable),
                'fee',
                [
                    'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
                    'length' => '12,4',
                    'default' => 0.00,
                    'nullable' => true,
                    'comment' => 'Extra fee'
                ]
            );
        $setup->endSetup();
    }
}

Hopefully, you find the solution in the above method.

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.