Skip to content

Commit 46c5b9c

Browse files
committed
MC-35634: If is_in_stock is set to 1 in the CSV file, products with Qty=0 are displayed on the frontend
1 parent e47d742 commit 46c5b9c

File tree

1 file changed

+4
-1
lines changed
  • app/code/Magento/CatalogImportExport/Model/Import

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3062,7 +3062,7 @@ private function formatStockDataForRow(array $rowData): array
30623062
$stockItemDo = $this->stockRegistry->getStockItem($row['product_id'], $row['website_id']);
30633063
$existStockData = $stockItemDo->getData();
30643064

3065-
if (isset($rowData['qty']) && $rowData['qty'] == 0) {
3065+
if (isset($rowData['qty']) && $rowData['qty'] == 0 && !isset($rowData['is_in_stock'])) {
30663066
$rowData['is_in_stock'] = 0;
30673067
}
30683068

@@ -3074,6 +3074,9 @@ private function formatStockDataForRow(array $rowData): array
30743074
);
30753075

30763076
if ($this->stockConfiguration->isQty($this->skuProcessor->getNewSku($sku)['type_id'])) {
3077+
if (isset($rowData['qty']) && $rowData['qty'] == 0) {
3078+
$row['is_in_stock'] = 0;
3079+
}
30773080
$stockItemDo->setData($row);
30783081
$row['is_in_stock'] = $row['is_in_stock'] ?? $this->stockStateProvider->verifyStock($stockItemDo);
30793082
if ($this->stockStateProvider->verifyNotification($stockItemDo)) {

0 commit comments

Comments
 (0)