Skip to content

Commit fc6bebe

Browse files
committed
functionality fixes
1 parent 1a42922 commit fc6bebe

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

app/code/Magento/Sales/Model/AdminOrder/Create.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ public function moveQuoteItem($item, $moveTo, $qty)
877877
}
878878

879879
$cartItems = $cart->getAllVisibleItems();
880-
$canBeRestored = (bool)$this->restoreTransferredItems('cart', $cartItems, $product);
880+
$canBeRestored = (bool)$this->restoreTransferredItem('cart', $cartItems, $product);
881881
if (!$canBeRestored) {
882882
$cartItem = $cart->addProduct($product, $info);
883883
if (is_string($cartItem)) {
@@ -928,7 +928,7 @@ public function moveQuoteItem($item, $moveTo, $qty)
928928
$this->getSession()->getStoreId()
929929
);
930930
$wishlistItems = $wishlist->getItemCollection()->getItems();
931-
$canBeRestored = (bool)$this->restoreTransferredItems('wishlist', $wishlistItems, null);
931+
$canBeRestored = (bool)$this->restoreTransferredItem('wishlist', $wishlistItems, null);
932932
if (!$canBeRestored) {
933933
$wishlist->addNewItem($item->getProduct(), $info);
934934
}
@@ -2061,18 +2061,21 @@ private function removeTransferredItems(): void
20612061
}
20622062

20632063
/**
2064-
* Restore items that were transferred from their original sources (cart, wishlist, ...) into ordered items
2064+
* Restore items that were transferred from from ordered items to their original sources (cart, wishlist, ...)
20652065
*
20662066
* @param string $area
20672067
* @param \Magento\Quote\Model\Quote\Item[]|\Magento\Wishlist\Model\Item[] $items
20682068
* @param \Magento\Catalog\Model\Product|null $product Product
20692069
* @return bool
20702070
*/
2071-
private function restoreTransferredItems($area, $items, $product = null): bool
2071+
private function restoreTransferredItem($area, $items, $product = null): bool
20722072
{
20732073
$transferredItems = $this->_session->getTransferredItems() ?? [];
20742074
switch ($area) {
20752075
case 'wishlist':
2076+
if (!isset($transferredItems['wishlist'])) {
2077+
return false;
2078+
}
20762079
$transferredFromWishlist = array_intersect_key($items, $transferredItems['wishlist']);
20772080
if ($transferredFromWishlist) {
20782081
$wishlistItemId = array_key_first($transferredFromWishlist);

0 commit comments

Comments
 (0)