19
19
use Magento \Framework \Stdlib \ArrayManager ;
20
20
use Magento \Quote \Api \CartRepositoryInterface ;
21
21
use Magento \Quote \Api \Data \CartInterface ;
22
- use Magento \Quote \Api \GuestCartRepositoryInterface ;
23
22
use Magento \Quote \Model \MaskedQuoteIdToQuoteIdInterface ;
24
23
use Magento \Quote \Model \Quote ;
25
24
use Magento \QuoteGraphQl \Model \Cart \AddSimpleProductToCartProcessor ;
@@ -46,11 +45,6 @@ class AddSimpleProductsToCart implements ResolverInterface
46
45
*/
47
46
private $ maskedQuoteIdToQuoteId ;
48
47
49
- /**
50
- * @var GuestCartRepositoryInterface
51
- */
52
- private $ guestCartRepository ;
53
-
54
48
/**
55
49
* @var CartHydrator
56
50
*/
@@ -77,7 +71,6 @@ class AddSimpleProductsToCart implements ResolverInterface
77
71
* @param ArrayManager $arrayManager
78
72
* @param MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId
79
73
* @param CartRepositoryInterface $cartRepository
80
- * @param GuestCartRepositoryInterface $guestCartRepository
81
74
* @param ValueFactory $valueFactory
82
75
* @param UserContextInterface $userContext
83
76
*/
@@ -87,15 +80,13 @@ public function __construct(
87
80
ArrayManager $ arrayManager ,
88
81
MaskedQuoteIdToQuoteIdInterface $ maskedQuoteIdToQuoteId ,
89
82
CartRepositoryInterface $ cartRepository ,
90
- GuestCartRepositoryInterface $ guestCartRepository ,
91
83
ValueFactory $ valueFactory ,
92
84
UserContextInterface $ userContext
93
85
) {
94
86
$ this ->valueFactory = $ valueFactory ;
95
87
$ this ->userContext = $ userContext ;
96
88
$ this ->arrayManager = $ arrayManager ;
97
89
$ this ->cartHydrator = $ cartHydrator ;
98
- $ this ->guestCartRepository = $ guestCartRepository ;
99
90
$ this ->cartRepository = $ cartRepository ;
100
91
$ this ->maskedQuoteIdToQuoteId = $ maskedQuoteIdToQuoteId ;
101
92
$ this ->addSimpleProductToCartProcessor = $ addSimpleProductToCartProcessor ;
@@ -180,13 +171,8 @@ private function getCartErrors($cart): string
180
171
*/
181
172
private function getCart (string $ cartHash ): CartInterface
182
173
{
183
- $ customerId = $ this ->userContext ->getUserId ();
184
-
185
- if (!$ customerId ) {
186
- return $ this ->guestCartRepository ->get ($ cartHash );
187
- }
188
-
189
174
$ cartId = $ this ->maskedQuoteIdToQuoteId ->execute ((string ) $ cartHash );
175
+
190
176
return $ this ->cartRepository ->get ($ cartId );
191
177
}
192
178
}
0 commit comments