How to use sales_model_service_quote_submit_before event Magento 2?

When you want to save data to the sales_order from the quote table or before place an order you want to save data to the sales order table you can achieve this via the event observer approach.

You can save custom field value to the Order table before the order placed. The given event will also useful to copy quote data to the sales order table.

Event Name: sales_model_service_quote_submit_before

You can find the definition for the event from the Quote Module.

I have just used this event for the customization of the Extra Custom fee to the Grand total.

The event will be useful like, Adding extra Custom_Fee to the order total and saves the custom_fee value to the Sales_order table once successfully order placed.

I hope you have created an entry for the custom_fee in the quote and sales_order total.

Define Events in the events.xml file,

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_model_service_quote_submit_before">
        <observer name="save_custom_fee" instance="Jesadiya\Fees\Observer\AddCustomFee" />

Now Create an Observer file to Handle Logic once trigger an action for the event,

<?php declare(strict_types=1);
 * Save Custom Fee in sales_order before place an order.

namespace Jesadiya\Fees\Observer;

use Exception;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class AddCustomFee implements ObserverInterface
     * @param Observer $observer
     * @return $this;
     * @throws Exception
    public function execute(Observer $observer)
        $event = $observer->getEvent();
        // Get Order Object
        /* @var $order \Magento\Sales\Model\Order */
        $order = $event->getOrder();
        // Get Quote Object
        /** @var $quote \Magento\Quote\Model\Quote $quote */
        $quote = $event->getQuote();

        if ($quote->getCustomFee()) {
        return $this;

I haven’t added logic to save custom_fee value to the quote table that will be depend based on your requirements.

Before place an order, We are checking for the Get Quote Object using $quote and checking like the custom fee is set or not in the quote table.

If the Custom fee is available in the quote table, We can get it using, $quote->getCustomFee() and set it to the $order object.

Given code snippet automatically saved custom fee value to the custom_fee column the Order table.

You can use this event whenever you need to save data to the sales order table from the quote table.