Skip to content

Commit e9c8154

Browse files
committed
MC-33400: [Improvement] Magento\Checkout\Model\Cart::addOrderItem
1 parent 6523cc0 commit e9c8154

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

app/code/Magento/Sales/Model/Reorder/Reorder.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,13 @@ private function addItemsToCart(Quote $cart, ItemCollection $orderItems): void
203203
}
204204
}
205205

206-
/** @var ProductInterface $product */
207-
foreach ($products as $product) {
208-
if (!isset($orderItemsByProductId[$product->getId()])) {
206+
foreach ($orderItemsByProductId as $productId => $orderItems) {
207+
if (!isset($products[$productId])) {
209208
continue;
210209
}
211-
$orderItems = $orderItemsByProductId[$product->getId()];
210+
$product = $products[$productId];
212211
foreach ($orderItems as $orderItem) {
213-
$this->addItemToCart($orderItem, $cart, $product);
212+
$this->addItemToCart($orderItem, $cart, clone $product);
214213
}
215214
}
216215
}

0 commit comments

Comments
 (0)