Skip to content

Commit 430df92

Browse files
committed
ACP2E-368: Issue when adding multiple items in addProductsToCart graphQL mutation
1 parent 093eb32 commit 430df92

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

app/code/Magento/Quote/Model/Cart/AddProductsToCart.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ public function execute(string $maskedCartId, array $cartItems): AddProductsToCa
103103
$cart = $this->cartRepository->get($cartId);
104104

105105
foreach ($cartItems as $cartItemPosition => $cartItem) {
106-
if ($cartItemPosition != 0 && empty($cart->getItems())) {
107-
$cart = $this->cartRepository->get($cartId);
108-
}
109106
$this->addItemToCart($cart, $cartItem, $cartItemPosition);
110107
}
111108

app/code/Magento/Quote/Model/Quote.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,6 +1711,11 @@ public function addProduct(
17111711
throw new \Magento\Framework\Exception\LocalizedException(__(implode("\n", $errors)));
17121712
}
17131713

1714+
if ($items) {
1715+
$this->setTotalsCollectedFlag(false);
1716+
$this->_addresses = null;
1717+
}
1718+
17141719
$this->_eventManager->dispatch('sales_quote_product_add_after', ['items' => $items]);
17151720
return $parentItem;
17161721
}

0 commit comments

Comments
 (0)