Skip to content

Commit c0cc6e1

Browse files
author
Volodymyr Kublytskyi
committed
Fix exception message to avoid coupling of stock management with catalog
1 parent 05f9df7 commit c0cc6e1

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

app/code/Magento/CatalogInventory/Model/StockStateProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function checkQuoteItemQty(StockItemInterface $stockItem, $qty, $summaryQ
160160
}
161161

162162
if (!$this->checkQty($stockItem, $summaryQty) || !$this->checkQty($stockItem, $qty)) {
163-
$message = __('We don\'t have as many "%1" as you requested.', $stockItem->getProductName());
163+
$message = __('The requested qty is not available');
164164
$result->setHasError(true)->setMessage($message)->setQuoteMessage($message)->setQuoteMessageIndex('qty');
165165
return $result;
166166
} else {
@@ -212,7 +212,7 @@ public function checkQuoteItemQty(StockItemInterface $stockItem, $qty, $summaryQ
212212
}
213213
} elseif ($stockItem->getShowDefaultNotificationMessage()) {
214214
$result->setMessage(
215-
__('We don\'t have as many "%1" as you requested.', $stockItem->getProductName())
215+
__('The requested qty is not available')
216216
);
217217
}
218218
}

dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/UpdateItemQtyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function requestDataProvider(): array
113113
'request' => ['qty' => 230],
114114
'response' => [
115115
'success' => false,
116-
'error_message' => 'We don\'t have as many "Simple Product" as you requested.']
116+
'error_message' => 'The requested qty is not available']
117117
],
118118
];
119119
}

dev/tests/integration/testsuite/Magento/Multishipping/Controller/Checkout/CheckItemsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function requestDataProvider(): array
163163
'request' => ['qty' => 101],
164164
'response' => [
165165
'success' => false,
166-
'error_message' => 'We don\'t have as many "Simple Product" as you requested.']
166+
'error_message' => 'The requested qty is not available']
167167
],
168168
[
169169
'request' => ['qty' => 230],

dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public function testAddProductUpdateItem()
324324
$this->assertEquals(1, $quote->getItemsQty());
325325

326326
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
327-
$this->expectExceptionMessage('We don\'t have as many "Simple Product" as you requested.');
327+
$this->expectExceptionMessage('The requested qty is not available');
328328
$updateParams['qty'] = $productStockQty + 1;
329329
$quote->updateItem($updateParams['id'], $updateParams);
330330
}

0 commit comments

Comments
 (0)