Skip to content

Commit a474c0b

Browse files
committed
AC-2457: Checkout Improvements
1 parent 2800098 commit a474c0b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

app/code/Magento/Checkout/Controller/Sidebar/UpdateItemQty.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Checkout\Controller\Sidebar;
79

810
use Magento\Checkout\Model\Cart\RequestQuantityProcessor;
@@ -12,7 +14,6 @@
1214
use Magento\Framework\App\RequestInterface;
1315
use Magento\Framework\App\Response\Http;
1416
use Magento\Framework\App\ResponseInterface;
15-
use Magento\Framework\Exception\InputException;
1617
use Magento\Framework\Exception\LocalizedException;
1718
use Magento\Framework\Json\Helper\Data;
1819
use Psr\Log\LoggerInterface;
@@ -83,13 +84,13 @@ public function __construct(
8384
public function execute()
8485
{
8586
$itemId = (int)$this->request->getParam('item_id');
86-
$itemQty = $this->request->getParam('item_qty');
87+
$itemQty = (int)$this->request->getParam('item_qty');
8788

88-
if (!is_numeric($itemQty) || ($itemQty <=0)) {
89-
$e = new InputException(__('A non-numeric value found')) ;
90-
return $this->jsonResponse($e->getMessage());
89+
if ($itemQty <= 0) {
90+
return $this->jsonResponse(__('A non-numeric value found'));
9191
}
9292
$itemQty = $this->quantityProcessor->prepareQuantity($itemQty);
93+
9394
try {
9495
$this->sidebar->checkQuoteItem($itemId);
9596
$this->sidebar->updateQuoteItem($itemId, $itemQty);

app/code/Magento/Checkout/Test/Unit/Controller/Sidebar/UpdateItemQtyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function testExecuteWithException(): void
248248
/**
249249
* @return void
250250
*/
251-
public function testExecuteWithInputException(): void
251+
public function testExecuteWithNonNumericItemQty(): void
252252
{
253253
$this->requestMock
254254
->method('getParam')

0 commit comments

Comments
 (0)