Skip to content

Commit 519d2ef

Browse files
committed
ACP2E-4142: Post-Patch ACP2E-4118: Stock Threshold Change in Admin Causes Negative Salable Quantities and Stock Status Mismatch
1 parent a2bb2af commit 519d2ef

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3412,7 +3412,11 @@ private function formatStockDataForRow(array $rowData): array
34123412
}
34133413

34143414
if ($this->stockConfiguration->isQty($this->skuProcessor->getNewSku($sku)['type_id'])) {
3415-
$initialStatusStock = $existStockData['is_in_stock'] ?? $this->defaultStockData['is_in_stock'];
3415+
if (empty($existStockData)) {
3416+
$initialStatusStock = 0;
3417+
} else {
3418+
$initialStatusStock = $existStockData['is_in_stock'] ?? $this->defaultStockData['is_in_stock'];
3419+
}
34163420
unset($existStockData['is_in_stock']);
34173421

34183422
$row = $this->getMergedRowDetails($row, $existStockData, $rowData);

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ public function __construct(
7676
*/
7777
public function verifyStock(StockItemInterface $stockItem)
7878
{
79-
if ($stockItem->getQty() === null && $stockItem->getManageStock()) {
79+
if ((int) $stockItem->getQty() === 0 &&
80+
$stockItem->getManageStock() &&
81+
$stockItem->getBackorders() == StockItemInterface::BACKORDERS_NO
82+
) {
8083
return false;
8184
}
8285
if ($stockItem->getBackorders() == StockItemInterface::BACKORDERS_NO

0 commit comments

Comments
 (0)