I have created a functionality to replace default checkout cart quote values by my custom quote values, and it is working fine for me. But, when I am placing an order, order is taking checkout cart quote id, and the values are not same as my Custom quote values. Please guide me on this, thanks in advance.

  • On Order Call the event and Update from Observer your custom Quote id @Ronak Parmar. Jul 6, 2018 at 15:00

1 Answer 1


To fix this issue, I have used


observer method and written controller name condition as per my requirement. Here is the code.

File Path > - app/code/Vendor/ModuleName/etc/frontend/events.xml

<?xml version="1.0"?>  
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="controller_action_predispatch">
        <observer name="modulename" instance="Vendor\ModuleName\Observer\ObserverName" />

File Path > - app/code/Vendor/ModuleName/Observer/ObserverName.php

 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.

namespace Vendor\ModuleName\Observer;

use Magento\Framework\Event\ObserverInterface;

 * Description of ObserverName
 * @author 
class ObserverName implements ObserverInterface {

    protected $redirect;
    protected $onePage;
    protected $quoteFactory;
    protected $quoteRepository;

     * [__construct description]
     * @param \Magento\Framework\App\Response\RedirectInterface $redirect        [description]
     * @param \Magento\Quote\Model\QuoteFactory                 $quoteFactory    [description]
     * @param \Magento\Checkout\Model\Type\Onepage              $onePage         [description]
     * @param \Magento\Quote\Api\CartRepositoryInterface        $quoteRepository [description]
    public function __construct(
        \Magento\Framework\App\Response\RedirectInterface $redirect,
        \Magento\Quote\Model\QuoteFactory $quoteFactory,
        \Magento\Checkout\Model\Type\Onepage $onePage,
        \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
    ) {
        $this->redirect        = $redirect;
        $this->quoteFactory    = $quoteFactory;
        $this->quoteRepository = $quoteRepository;
        $this->onePage         = $onePage;

    public function execute(\Magento\Framework\Event\Observer $observer) {
        $event   = $observer->getEvent();
        $request = $event->getRequest();
        $redirectUrl = $this->redirect->getRedirectUrl();

        if (($redirectUrl == 'your_site_url' && $request->getFullActionName() == 'checkout_index_index')) {

            $quote // Here you have to get your Custom Quote.
            $this->checkoutSession->setQuoteId($custom_QuoteId); // $custom_QuoteId = You have to Pass here your custom quote id.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.