59 \
Magento\Persistent\Helper\Data $persistentData,
60 \
Magento\Customer\Model\Session $customerSession,
65 $this->_persistentData = $persistentData;
66 $this->_customerSession = $customerSession;
81 if (!$this->_persistentData->canProcess(
$observer) || !$this->_persistentData->isShoppingCartPersist()) {
85 if ($this->_persistentSession->isPersistent() && !$this->_customerSession->isLoggedIn()) {
87 $customer = $this->customerRepository->getById($this->_persistentSession->getSession()->getCustomerId());
88 if ($defaultShipping =
$customer->getDefaultShipping()) {
90 $address = $this->addressRepository->getById($defaultShipping);
92 $this->_customerSession->setDefaultTaxShippingAddress(
94 'country_id' =>
$address->getCountryId(),
98 'postcode' =>
$address->getPostcode(),
104 if ($defaultBilling =
$customer->getDefaultBilling()) {
105 $address = $this->addressRepository->getById($defaultBilling);
107 $this->_customerSession->setDefaultTaxBillingAddress([
108 'country_id' =>
$address->getCountryId(),
110 'postcode' =>
$address->getPostcode(),
114 $this->_customerSession
116 ->setCustomerGroupId(
$customer->getGroupId())
117 ->setIsCustomerEmulated(
true);
__construct(\Magento\Persistent\Helper\Session $persistentSession, \Magento\Persistent\Helper\Data $persistentData, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository, \Magento\Customer\Api\AddressRepositoryInterface $addressRepository)
execute(Observer $observer)