Skip to content

Commit 8d39f4c

Browse files
authored
Merge pull request magento#996 from magento-engcom/MSI-875
MSI-875: issue with duplicating SKU in one Order
2 parents 0e897d7 + 0eef33b commit 8d39f4c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/code/Magento/InventorySales/Plugin/Sales/OrderManagement/AppendReservationsAfterOrderPlacementPlugin.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ public function afterPlace(OrderManagementInterface $subject, OrderInterface $or
102102
$itemsById = [];
103103
/** @var OrderItemInterface $item **/
104104
foreach ($order->getItems() as $item) {
105-
$itemsById[$item->getProductId()] = $item->getQtyOrdered();
105+
if (!isset($itemsById[$item->getProductId()])) {
106+
$itemsById[$item->getProductId()] = 0;
107+
}
108+
$itemsById[$item->getProductId()] += $item->getQtyOrdered();
106109
}
107110
$productSkus = $this->getSkusByProductIds->execute(array_keys($itemsById));
108111
/** @var ItemToSellInterface[] $itemsToSell */

0 commit comments

Comments
 (0)