Skip to content

Commit d80a4aa

Browse files
author
Stanislav Idolov
authored
ENGCOM-2810: Change error message about low stock #17642
2 parents 9b01481 + b5a95c9 commit d80a4aa

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-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
}

dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@
8585
$invoice = $invoiceFactory->prepareInvoice($order, [$item->getId() => 10]);
8686
$invoice->register();
8787
$invoice->save();
88+
$order->save();
89+
90+
$invoice = $objectManager->get(\Magento\Sales\Api\InvoiceRepositoryInterface::class)->get($invoice->getId());
8891

8992
/** @var \Magento\Sales\Model\Order\CreditmemoFactory $creditmemoFactory */
9093
$creditmemoFactory = $objectManager->get(\Magento\Sales\Model\Order\CreditmemoFactory::class);

0 commit comments

Comments
 (0)