Skip to content

Commit 468383e

Browse files
MC-39104: 2 error messages in Cart when product is out of stock
1 parent 60e6c68 commit 468383e

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ public function validate(Observer $observer)
165165
Data::ERROR_QTY,
166166
__('This product is out of stock.')
167167
);
168+
} else {
169+
$quoteItem->addErrorInfo(null, Data::ERROR_QTY);
168170
}
169171
$quoteItem->getQuote()->addErrorInfo(
170172
'stock',

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
<actionGroup ref="AdminSetStockStatusActionGroup" stepKey="outOfStockStatus">
126126
<argument name="stockStatus" value="Out of Stock"/>
127127
</actionGroup>
128-
128+
129129
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveSecondProductForm"/>
130130
<!-- Go to created customer page -->
131131
<comment userInput="Go to created customer page" stepKey="goToCreatedCustomerPage"/>
@@ -158,7 +158,7 @@
158158
<waitForPageLoad stepKey="waitForPageLoad"/>
159159
<click selector="{{AdminOrderFormItemsSection.addSelected}}" stepKey="clickToAddProductToOrder"/>
160160
<waitForPageLoad stepKey="waitForNewOrderPageLoad"/>
161-
<see userInput="This product is out of stock." stepKey="seeTheErrorMessageDisplayed"/>
161+
<see userInput="There are no source items with the in stock status" stepKey="seeTheErrorMessageDisplayed"/>
162162

163163
<actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="createNewOrderThirdTime">
164164
<argument name="customer" value="$createCustomer$"/>

dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartItemRepositoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public function updateItemDataProvider(): array
265265
'use_config_backorders' => 0,
266266
'backorders' => Stock::BACKORDERS_NO,
267267
],
268-
'This product is out of stock.'
268+
'There are no source items with the in stock status'
269269
],
270270
[
271271
[

0 commit comments

Comments
 (0)