/** * Set quote to be loaded even if not active * * @param \Magento\Framework\Event\Observer $observer * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function execute(\Magento\Framework\Event\Observer $observer) { if (!($this->_persistentSession->isPersistent() && !$this->_customerSession->isLoggedIn() && !$this->_persistentData->isShoppingCartPersist())) { return; } if ($this->_checkoutSession) { $this->_checkoutSession->setLoadInactive(); } }
/** * Expire persistent quote * * @return void */ public function expire() { $quote = $this->checkoutSession->setLoadInactive()->getQuote(); if ($quote->getIsActive() && $quote->getCustomerId()) { $this->checkoutSession->setCustomerData(null)->clearQuote()->clearStorage(); } else { $quote->setIsActive(true)->setIsPersistent(false)->setCustomerId(null)->setCustomerGroupId(\Magento\Customer\Api\Data\GroupInterface::NOT_LOGGED_IN_ID); } }
/** * @return void */ protected function _expirePersistentSession() { $quote = $this->_checkoutSession->setLoadInactive()->getQuote(); if ($quote->getIsActive() && $quote->getCustomerId()) { $this->_checkoutSession->setCustomerData(null)->clearQuote()->clearStorage(); } else { $quote->setIsActive(true)->setIsPersistent(false)->setCustomerId(null)->setCustomerGroupId(\Magento\Customer\Service\V1\CustomerGroupServiceInterface::NOT_LOGGED_IN_ID); } }