diff --git a/vendor/magento/module-login-as-customer-frontend-ui/Controller/Login/Index.php b/vendor/magento/module-login-as-customer-frontend-ui/Controller/Login/Index.php index 2f529b02637de..d73ba9457e051 100644 --- a/vendor/magento/module-login-as-customer-frontend-ui/Controller/Login/Index.php +++ b/vendor/magento/module-login-as-customer-frontend-ui/Controller/Login/Index.php @@ -1,13 +1,12 @@ resultFactory = $resultFactory; $this->request = $request; - $this->customerRepository = $customerRepository; - $this->getAuthenticationDataBySecret = $getAuthenticationDataBySecret; $this->authenticateCustomerBySecret = $authenticateCustomerBySecret; $this->messageManager = $messageManager; $this->logger = $logger; $this->customerSession = $customerSession ?? ObjectManager::getInstance()->get(Session::class); + $this->checkoutSession = $checkoutSession + ?? ObjectManager::getInstance()->get(CheckoutSession::class); } /** @@ -109,6 +99,10 @@ public function execute(): ResultInterface $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); $secret = $this->request->getParam('secret'); + if ($this->checkoutSession->getQuoteId()) { + $this->checkoutSession->clearQuote(); + $this->checkoutSession->clearStorage(); + } try { $this->authenticateCustomerBySecret->execute($secret); $customer = $this->customerSession->getCustomer();