Skip to content

Commit 2a94995

Browse files
authored
Merge pull request #164 from ihorvansach/magento2-login-as-customer/issues/159
Magento2 login as customer/issues/159
2 parents 94a08ef + c6535cb commit 2a94995

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

app/code/Magento/LoginAsCustomerQuote/Plugin/LoginAsCustomerApi/ProcessShoppingCartPlugin.php

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Magento\LoginAsCustomerApi\Api\GetAuthenticationDataBySecretInterface;
1616

1717
/**
18-
* Remove all items from guest shopping cart before execute. Mark customer cart as not-guest after execute
18+
* Remove all items from guest shopping cart and mark cart as not-guest
1919
*
2020
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2121
*/
@@ -60,7 +60,7 @@ public function __construct(
6060
}
6161

6262
/**
63-
* Remove all items from guest shopping cart
63+
* Remove all items from guest shopping cart and mark cart as not-guest
6464
*
6565
* @param AuthenticateCustomerBySecretInterface $subject
6666
* @param string $secret
@@ -77,31 +77,9 @@ public function beforeExecute(
7777
$quote = $this->checkoutSession->getQuote();
7878
/* Remove items from guest cart */
7979
$quote->removeAllItems();
80+
$quote->setCustomerIsGuest(0);
8081
$this->quoteRepository->save($quote);
8182
}
8283
return null;
8384
}
84-
85-
/**
86-
* Mark customer cart as not-guest
87-
*
88-
* @param AuthenticateCustomerBySecretInterface $subject
89-
* @param void $result
90-
* @param string $secret
91-
* @return void
92-
* @throws LocalizedException
93-
*
94-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
95-
*/
96-
public function afterExecute(
97-
AuthenticateCustomerBySecretInterface $subject,
98-
$result,
99-
string $secret
100-
) {
101-
$this->checkoutSession->loadCustomerQuote();
102-
$quote = $this->checkoutSession->getQuote();
103-
104-
$quote->setCustomerIsGuest(0);
105-
$this->quoteRepository->save($quote);
106-
}
10785
}

0 commit comments

Comments
 (0)