Skip to content

Commit 19cc4b9

Browse files
author
Oleksandr Iegorov
committed
MC-42652: GraphQL - Expected behavior of add product to cart when SKU already exists
1 parent 918060d commit 19cc4b9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ public function execute(Quote $cart, array $cartItemData): void
8989
}
9090

9191
try {
92+
$items = [];
93+
$collection = $cart->getItemsCollection(false);
94+
foreach ($collection as $item) {
95+
$items[] = $item;
96+
}
97+
$cart->setItems($items);
9298
$result = $cart->addProduct($product, $this->buyRequestBuilder->build($cartItemData));
9399
/*
94100
$result = $this->addProductToCartWithConcurrency(

0 commit comments

Comments
 (0)