Skip to content

Commit a1e9ecc

Browse files
committed
MCP-584: Disable inventory check on quote load
- Add stock status check to prevent order placement with positive qty but with out of stock status when inventory check is disabled;
1 parent 3a6e03c commit a1e9ecc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function registerProductsSale($items, $websiteId = null)
119119
) {
120120
$this->getResource()->commit();
121121
throw new \Magento\Framework\Exception\LocalizedException(
122-
__('Not all of your products are available in the requested quantity.')
122+
__('Some of the products are out of stock.')
123123
);
124124
}
125125
if ($this->canSubtractQty($stockItem)) {
@@ -137,7 +137,7 @@ public function registerProductsSale($items, $websiteId = null)
137137
}
138138
$this->qtyCounter->correctItemsQty($registeredItems, $websiteId, '-');
139139
$this->getResource()->commit();
140-
140+
141141
return $fullSaveItems;
142142
}
143143

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ public function checkQty(StockItemInterface $stockItem, $qty)
249249
if (!$stockItem->getManageStock()) {
250250
return true;
251251
}
252+
if (!$stockItem->getIsInStock()) {
253+
return false;
254+
}
252255
if ($stockItem->getQty() - $stockItem->getMinQty() - $qty < 0) {
253256
switch ($stockItem->getBackorders()) {
254257
case \Magento\CatalogInventory\Model\Stock::BACKORDERS_YES_NONOTIFY:

0 commit comments

Comments
 (0)