Skip to content

Commit 1fb3a97

Browse files
committed
Update fetching quote item by id
Fixes #9445 Fix's issue when quote item without id is added to collection
1 parent d03bc98 commit 1fb3a97

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

app/code/Magento/Quote/Model/Quote.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,11 +1444,17 @@ public function hasProductId($productId)
14441444
* Retrieve item model object by item identifier
14451445
*
14461446
* @param int $itemId
1447-
* @return \Magento\Quote\Model\Quote\Item
1447+
* @return \Magento\Quote\Model\Quote\Item|false
14481448
*/
14491449
public function getItemById($itemId)
14501450
{
1451-
return $this->getItemsCollection()->getItemById($itemId);
1451+
foreach ($this->getItemsCollection() as $item) {
1452+
if ($item->getId() == $itemId) {
1453+
return $item;
1454+
}
1455+
}
1456+
1457+
return false;
14521458
}
14531459

14541460
/**

0 commit comments

Comments
 (0)