Skip to content

Commit 5d3b09d

Browse files
committed
ACP2E-2174: allow qty change for cart items without errors
1 parent 05853c0 commit 5d3b09d

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

app/code/Magento/Checkout/Model/Cart.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -536,13 +536,12 @@ public function updateItems($data)
536536

537537
$qty = isset($itemInfo['qty']) ? (double)$itemInfo['qty'] : false;
538538
if ($qty > 0) {
539+
$item->clearMessage();
540+
$item->setHasError(false);
541+
$item->setQty($qty);
542+
539543
if ($item->getHasError()) {
540-
$deferredErrors[$item->getId()] = __($item->getMessage());
541-
continue;
542-
} else {
543-
$item->clearMessage();
544-
$item->setHasError(false);
545-
$item->setQty($qty);
544+
throw new \Magento\Framework\Exception\LocalizedException(__($item->getMessage()));
546545
}
547546

548547
if (isset($itemInfo['before_suggest_qty']) && $itemInfo['before_suggest_qty'] != $qty) {
@@ -566,10 +565,6 @@ public function updateItems($data)
566565
['cart' => $this, 'info' => $infoDataObject]
567566
);
568567

569-
if (count($deferredErrors)) {
570-
throw new \Magento\Framework\Exception\LocalizedException(current($deferredErrors));
571-
}
572-
573568
return $this;
574569
}
575570

0 commit comments

Comments
 (0)