diff --git a/vendor/magento/module-persistent/Observer/SetCheckoutSessionPersistentDataObserver.php b/vendor/magento/module-persistent/Observer/SetCheckoutSessionPersistentDataObserver.php index 8b14792a0e389..40de1e341e433 100644 --- a/vendor/magento/module-persistent/Observer/SetCheckoutSessionPersistentDataObserver.php +++ b/vendor/magento/module-persistent/Observer/SetCheckoutSessionPersistentDataObserver.php @@ -9,11 +9,9 @@ use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Model\Session as CustomerSession; -use Magento\Framework\App\ObjectManager; use Magento\Framework\Event\ObserverInterface; use Magento\Persistent\Helper\Data; use Magento\Persistent\Helper\Session; -use Magento\Persistent\Model\SessionFactory; /** * Event SetCheckoutSessionPersistentData @@ -49,32 +47,22 @@ class SetCheckoutSessionPersistentDataObserver implements ObserverInterface */ private $customerRepository = null; - /** - * Session factory class - * - * @var SessionFactory - */ - private $sessionFactory; - /** * @param Session $persistentSession * @param CustomerSession $customerSession * @param Data $persistentData * @param CustomerRepositoryInterface $customerRepository - * @param SessionFactory $sessionFactory */ public function __construct( Session $persistentSession, CustomerSession $customerSession, Data $persistentData, - CustomerRepositoryInterface $customerRepository, - ?SessionFactory $sessionFactory = null + CustomerRepositoryInterface $customerRepository ) { $this->persistentSession = $persistentSession; $this->customerSession = $customerSession; $this->persistentData = $persistentData; $this->customerRepository = $customerRepository; - $this->sessionFactory = $sessionFactory ?? ObjectManager::getInstance()->get(SessionFactory::class); } /** @@ -90,12 +78,6 @@ public function execute(\Magento\Framework\Event\Observer $observer) /** @var $checkoutSession \Magento\Checkout\Model\Session */ $checkoutSession = $observer->getEvent()->getData('checkout_session'); if ($this->persistentData->isShoppingCartPersist() && $this->persistentSession->isPersistent()) { - if (!$this->customerSession->isLoggedIn() && $this->persistentData->getClearOnLogout()) { - $this->sessionFactory->create()->removePersistentCookie(); - // Unset persistent session - $this->persistentSession->setSession(null); - return; - } $checkoutSession->setCustomerData( $this->customerRepository->getById($this->persistentSession->getSession()->getCustomerId()) );