15
15
use Magento \LoginAsCustomerApi \Api \GetAuthenticationDataBySecretInterface ;
16
16
17
17
/**
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
19
19
*
20
20
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
21
21
*/
@@ -60,7 +60,7 @@ public function __construct(
60
60
}
61
61
62
62
/**
63
- * Remove all items from guest shopping cart
63
+ * Remove all items from guest shopping cart and mark cart as not-guest
64
64
*
65
65
* @param AuthenticateCustomerBySecretInterface $subject
66
66
* @param string $secret
@@ -77,31 +77,9 @@ public function beforeExecute(
77
77
$ quote = $ this ->checkoutSession ->getQuote ();
78
78
/* Remove items from guest cart */
79
79
$ quote ->removeAllItems ();
80
+ $ quote ->setCustomerIsGuest (0 );
80
81
$ this ->quoteRepository ->save ($ quote );
81
82
}
82
83
return null ;
83
84
}
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
- }
107
85
}
0 commit comments