Skip to content

Commit 30f7e86

Browse files
committed
ACP2E-2174: allow qty change for cart items without errors
1 parent b4e6dd5 commit 30f7e86

File tree

2 files changed

+10
-13
lines changed
  • app/code/Magento/Checkout/Model
  • dev/tests/integration/testsuite/Magento/Checkout/Controller

2 files changed

+10
-13
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,6 @@ public function updateItems($data)
536536

537537
$qty = isset($itemInfo['qty']) ? (double)$itemInfo['qty'] : false;
538538
if ($qty > 0) {
539-
if ($item->getHasError()) {
540-
$item->setUseOldQty(true);
541-
}
542539
$item->clearMessage();
543540
$item->setHasError(false);
544541
$item->setQty($qty);

dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ public function testReorderItems(bool $loggedIn, string $request)
394394
$customerSession = $this->_objectManager->get(CustomerSession::class);
395395
$customerSession->logout();
396396

397-
$checkoutSession = Bootstrap::getObjectManager()->get(Session::class);
397+
$checkoutSession = Bootstrap::getObjectManager()->get(CheckoutSession::class);
398398
$expected = [];
399399
if ($loggedIn && $request == Request::METHOD_POST) {
400400
$customer = $this->_objectManager->create(CustomerRepository::class)->get('customer2@example.com');
@@ -529,16 +529,16 @@ public function testUpdatePostActionWithMultipleProducts()
529529

530530
$response = $this->updatePostRequest($quote, $item1, $item2, $updatedQuantity, $updatedQuantity, true);
531531

532-
$this->assertContains(
533-
'[{"error":"There are no source items with the in stock status","itemId":'.$item1->getId().'}]',
534-
$response
532+
$this->assertStringContainsString(
533+
'"itemId":'.$item1->getId().'}]',
534+
$response['error_message']
535535
);
536536

537537
$response = $this->updatePostRequest($quote, $item1, $item2, $originalQuantity, $updatedQuantity, false);
538538

539-
$this->assertContains(
540-
'[{"error":"There are no source items with the in stock status","itemId":'.$item1->getId().'}]',
541-
$response
539+
$this->assertStringContainsString(
540+
'"itemId":'.$item1->getId().'}]',
541+
$response['error_message']
542542
);
543543
$this->assertEquals(
544544
$originalQuantity + $updatedQuantity,
@@ -548,9 +548,9 @@ public function testUpdatePostActionWithMultipleProducts()
548548

549549
$response = $this->updatePostRequest($quote, $item1, $item2, $updatedQuantity, $updatedQuantity, false);
550550

551-
$this->assertContains(
552-
'[{"error":"There are no source items with the in stock status","itemId":'.$item1->getId().'}]',
553-
$response
551+
$this->assertStringContainsString(
552+
'"itemId":'.$item1->getId().'}]',
553+
$response['error_message']
554554
);
555555
$this->assertEquals(
556556
$originalQuantity + $updatedQuantity,

0 commit comments

Comments
 (0)