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

How to Set and Get Admin Session Quote in Magento 2

By Chandresh ChauhanUpdated on May 22, 2025 1 min read

This post includes the method to set and get admin session quote in Magento 2 store.

If you want to retrieve the quote data from the admin panel, you can use the below solution. Also you can sometimes while Magento 2 module customization or Magento 2 module development, you may need to get set and unset custom session variable in Magento 2.

Or you may even set quote in admin side session using quote ID.

Get the items that are present in the quote of admin order

Method to Set and Get Admin Session Quote in Magento 2:

<?php

namespace Vendor\Extension\Helper;

use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Helper\Context;
use Magento\Backend\Model\Session\Quote as BackendModelSession;

class Data extends AbstractHelper
{
        protected $backendModelSession;
    
    public function __construct(
        Context $context,
        BackendModelSession $backendModelSession
    )
    {
        $this->backendModelSession = $backendModelSession;
        parent::__construct($context);
    }
    
    public function setBackendQuote(){
        $customerId = 5;
        $quoteId = 111;
        
        $this->backendModelSession->setCustomerId($customerId);
        $this->backendModelSession->setQuoteId($quoteId);
        $this->backendModelSession->setStoreId(1);
    }
    
    public function getBackendQuote(){
        $quote = $this->backendModelSession->getQuote();
        return $quote;
    }
}

That’s it.

Do share the solution with the Magento Community via social media.

Thank you.

Chandresh Chauhan Full Image
Article byChandresh Chauhan

He has been with Meetanshi for more than three years now as a certified Magento developer. A silent guy whom you can always find solving clients' issues, is an avid reader too.