I figured it out myself. Patch these two will get the other inventory stocks updated like the logic of the default one.
@package magento/module-inventory-indexer
--- Indexer/SelectBuilder.php
+++ Indexer/SelectBuilder.php (date 1631043163343)
@@ -79,11 +79,12 @@
[]
);
+ $this->getIsStockItemSalableCondition->stockStatusColumn = '`status`';
$select->from(
['source_item' => $sourceItemTable],
[
SourceItemInterface::SKU,
- IndexStructure::QUANTITY => 'SUM(' . $quantityExpression . ')',
+ IndexStructure::QUANTITY => 'SUM(`' . SourceItemInterface::QUANTITY . '`)',
IndexStructure::IS_SALABLE => $this->getIsStockItemSalableCondition->execute($select),
]
)
@package magento/module-inventory-sales
--- Model/ResourceModel/IsStockItemSalableCondition/IsStockItemSalableConditionChain.php
+++ Model/ResourceModel/IsStockItemSalableCondition/IsStockItemSalableConditionChain.php (date 1631043236344)
@@ -66,6 +66,6 @@
}
$isSalableString = '(' . implode(') OR (', $conditionStrings) . ')';
- return (string)$this->resourceConnection->getConnection()->getCheckSql($isSalableString, 1, 0);
+ return (string)$this->resourceConnection->getConnection()->getCheckSql($isSalableString, isset($this->stockStatusColumn) ? $this->stockStatusColumn : 1, 0);
}
}