Skip to content

Commit b13c5f0

Browse files
committed
ACP2E-3255: [GRAPHQL] model value should be specified when getting customerCart
- Fixed the static test failure.
1 parent b8a89a4 commit b13c5f0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

app/code/Magento/QuoteGraphQl/Plugin/Model/CreateEmptyCartWithoutCountryValidation.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public function __construct(
3232
private readonly CartRepositoryInterface $quoteRepository,
3333
private readonly CustomerRepositoryInterface $customerRepository,
3434
private readonly QuoteFactory $quoteFactory
35-
) {}
35+
) {
36+
}
3637

3738
/**
3839
* Create empty cart for customer without country validation
@@ -50,10 +51,9 @@ public function aroundCreateEmptyCartForCustomer(
5051
QuoteManagement $subject,
5152
Closure $proceed,
5253
int $customerId
53-
): bool|int
54-
{
54+
): bool|int {
5555
$storeId = (int) $this->storeManager->getStore()->getStoreId();
56-
$quote = $this->createCustomerCart($customerId,$storeId);
56+
$quote = $this->createCustomerCart($customerId, $storeId);
5757

5858
try {
5959
$this->quoteRepository->save($quote);
@@ -75,14 +75,14 @@ public function aroundCreateEmptyCartForCustomer(
7575
private function createCustomerCart(int $customerId, int $storeId): Quote
7676
{
7777
try {
78-
$quote = $this->quoteRepository->getActiveForCustomer($customerId);
78+
$activeQuote = $this->quoteRepository->getActiveForCustomer($customerId);
7979
} catch (NoSuchEntityException $e) {
80-
$customer = $this->customerRepository->getById($customerId);
81-
$quote = $this->quoteFactory->create();
82-
$quote->setStoreId($storeId);
83-
$quote->setCustomer($customer);
84-
$quote->setCustomerIsGuest(0);
80+
$activeCustomer = $this->customerRepository->getById($customerId);
81+
$activeQuote = $this->quoteFactory->create();
82+
$activeQuote->setStoreId($storeId);
83+
$activeQuote->setCustomer($activeCustomer);
84+
$activeQuote->setCustomerIsGuest(0);
8585
}
86-
return $quote;
86+
return $activeQuote;
8787
}
8888
}

0 commit comments

Comments
 (0)