@@ -877,7 +877,7 @@ public function moveQuoteItem($item, $moveTo, $qty)
877
877
}
878
878
879
879
$ cartItems = $ cart ->getAllVisibleItems ();
880
- $ canBeRestored = (bool )$ this ->restoreTransferredItems ('cart ' , $ cartItems , $ product );
880
+ $ canBeRestored = (bool )$ this ->restoreTransferredItem ('cart ' , $ cartItems , $ product );
881
881
if (!$ canBeRestored ) {
882
882
$ cartItem = $ cart ->addProduct ($ product , $ info );
883
883
if (is_string ($ cartItem )) {
@@ -928,7 +928,7 @@ public function moveQuoteItem($item, $moveTo, $qty)
928
928
$ this ->getSession ()->getStoreId ()
929
929
);
930
930
$ wishlistItems = $ wishlist ->getItemCollection ()->getItems ();
931
- $ canBeRestored = (bool )$ this ->restoreTransferredItems ('wishlist ' , $ wishlistItems , null );
931
+ $ canBeRestored = (bool )$ this ->restoreTransferredItem ('wishlist ' , $ wishlistItems , null );
932
932
if (!$ canBeRestored ) {
933
933
$ wishlist ->addNewItem ($ item ->getProduct (), $ info );
934
934
}
@@ -2061,18 +2061,21 @@ private function removeTransferredItems(): void
2061
2061
}
2062
2062
2063
2063
/**
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, ...)
2065
2065
*
2066
2066
* @param string $area
2067
2067
* @param \Magento\Quote\Model\Quote\Item[]|\Magento\Wishlist\Model\Item[] $items
2068
2068
* @param \Magento\Catalog\Model\Product|null $product Product
2069
2069
* @return bool
2070
2070
*/
2071
- private function restoreTransferredItems ($ area , $ items , $ product = null ): bool
2071
+ private function restoreTransferredItem ($ area , $ items , $ product = null ): bool
2072
2072
{
2073
2073
$ transferredItems = $ this ->_session ->getTransferredItems () ?? [];
2074
2074
switch ($ area ) {
2075
2075
case 'wishlist ' :
2076
+ if (!isset ($ transferredItems ['wishlist ' ])) {
2077
+ return false ;
2078
+ }
2076
2079
$ transferredFromWishlist = array_intersect_key ($ items , $ transferredItems ['wishlist ' ]);
2077
2080
if ($ transferredFromWishlist ) {
2078
2081
$ wishlistItemId = array_key_first ($ transferredFromWishlist );
0 commit comments