Helper/Session.php
public function loadSession($quote)
    {
        // not an API call, no need to emulate session
        if ($this->appState->getAreaCode() != \Magento\Framework\App\Area::AREA_WEBAPI_REST) {
            $this->replaceQuote($quote);
            return;
        }

        $customerId = $quote->getCustomerId();
        $cacheIdentifier = self::BOLT_SESSION_PREFIX . $quote->getBoltParentQuoteId();

        if ($serialized = $this->cache->load($cacheIdentifier)) {
            $sessionData = unserialize($serialized);
            $sessionID = $sessionData["sessionID"];

            if ($sessionData["sessionType"] == "frontend") {
                // shipping and tax, orphaned transaction
                // cart belongs to logged in customer?
                if ($customerId) {
                    $this->setSession($this->checkoutSession, $sessionID);
                    $this->setSession($this->customerSession, $sessionID);
                }
            } else {
                // orphaned transaction
                $this->setSession($this->adminCheckoutSession, $sessionID);
            }
        }

        if ($customerId) {
            $this->customerSession->loginById($customerId);
        }
        $this->replaceQuote($quote);
    }
public function loadSession($quote)
    {
        // not an API call, no need to emulate session
        if ($this->appState->getAreaCode() != \Magento\Framework\App\Area::AREA_WEBAPI_REST) {
            $this->replaceQuote($quote);
            return;
        }

        $customerId = $quote->getCustomerId();
        $cacheIdentifier = self::BOLT_SESSION_PREFIX . $quote->getBoltParentQuoteId();

        if ($serialized = $this->cache->load($cacheIdentifier)) {
            $sessionData = unserialize($serialized);
            $sessionID = $sessionData["sessionID"];

            if ($sessionData["sessionType"] == "frontend") {
                // shipping and tax, orphaned transaction
                // cart belongs to logged in customer?
                if ($customerId) {
                    $this->setSession($this->checkoutSession, $sessionID);
                    $this->setSession($this->customerSession, $sessionID);
                }
            } else {
                // orphaned transaction
                $this->setSession($this->adminCheckoutSession, $sessionID);
            }
        }

        if ($customerId) {
            $this->customerSession->loginById($customerId);
        }
        $this->replaceQuote($quote);
    }
public function loadSession ( $ quote ) { // not an API call, no need to emulate session if ( $ this -> appState -> getAreaCode ( ) != \ Magento \ Framework \ App \ Area :: AREA_WEBAPI_REST ) { $ this -> replaceQuote ( $ quote ) ; return ; } $ customerId = $ quote -> getCustomerId ( ) ; $ cacheIdentifier = self :: BOLT_SESSION_PREFIX . $ quote -> getBoltParentQuoteId ( ) ; if ( $ serialized = $ this -> cache -> load ( $ cacheIdentifier ) ) { $ sessionData = unserialize ( $ serialized ) ; $ sessionID = $ sessionData [ "sessionID" ] ; if ( $ sessionData [ "sessionType" ] == "frontend" ) { // shipping and tax, orphaned transaction // cart belongs to logged in customer? if ( $ customerId ) { $ this -> setSession ( $ this -> checkoutSession , $ sessionID ) ; $ this -> setSession ( $ this -> customerSession , $ sessionID ) ; } } else { // orphaned transaction $ this -> setSession ( $ this -> adminCheckoutSession , $ sessionID ) ; } } if ( $ customerId ) { $ this -> customerSession -> loginById ( $ customerId ) ; } $ this -> replaceQuote ( $ quote ) ; }
Load logged in customer checkout and customer sessions from cached session id.
Replace parent quote with immutable quote in checkout session.

@param Quote $quote
@throws \Magento\Framework\Exception\SessionException
Load logged in customer checkout and customer sessions from cached session id . Replace parent quote with immutable quote in checkout session .