_persistentSession = $persistentSession; $this->_persistentData = $persistentData; $this->_customerSession = $customerSession; $this->quoteManager = $quoteManager; } /** * Make persistent quote to be guest * * @param \Magento\Framework\Event\Observer $observer * @return void */ public function execute(\Magento\Framework\Event\Observer $observer) { /** @var $action \Magento\Persistent\Controller\Index */ $action = $observer->getEvent()->getControllerAction(); if ($action instanceof \Magento\Persistent\Controller\Index) { if ((($this->_persistentSession->isPersistent() && !$this->_customerSession->isLoggedIn()) || $this->_persistentData->isShoppingCartPersist()) ) { $this->quoteManager->setGuest(true); } } } }