diff --git a/vendor/magento/module-inventory-configuration/Model/InventoryConfiguration.php b/vendor/magento/module-inventory-configuration/Model/InventoryConfiguration.php
new file mode 100644
index 000000000000..acccac199005
--- /dev/null
+++ b/vendor/magento/module-inventory-configuration/Model/InventoryConfiguration.php
@@ -0,0 +1,130 @@
+legacyStockConfiguration = $legacyStockConfiguration;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function canSubtractQty($store = null): bool
+ {
+ return $this->legacyStockConfiguration->canSubtractQty($store);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getMinQty($store = null): float
+ {
+ return $this->legacyStockConfiguration->getMinQty($store);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getMinSaleQty($store = null, ?int $customerGroupId = null): float
+ {
+ return $this->legacyStockConfiguration->getMinSaleQty($store, $customerGroupId);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getMaxSaleQty($store = null): float
+ {
+ return $this->legacyStockConfiguration->getMaxSaleQty($store);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getNotifyStockQty($store = null): float
+ {
+ return $this->legacyStockConfiguration->getNotifyStockQty($store);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function isQtyIncrementsEnabled($store = null): bool
+ {
+ return $this->legacyStockConfiguration->getEnableQtyIncrements($store);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getQtyIncrements($store = null): float
+ {
+ return $this->legacyStockConfiguration->getQtyIncrements($store);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getBackorders($store = null): int
+ {
+ return $this->legacyStockConfiguration->getBackorders($store);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getManageStock($store = null): int
+ {
+ return $this->legacyStockConfiguration->getManageStock($store);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function isCanBackInStock($store = null): bool
+ {
+ return $this->legacyStockConfiguration->getCanBackInStock($store);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function isShowOutOfStock($store = null): bool
+ {
+ return $this->legacyStockConfiguration->isShowOutOfStock($store);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function isAutoReturnEnabled($store = null): bool
+ {
+ return $this->legacyStockConfiguration->isAutoReturnEnabled($store);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function isDisplayProductStockStatus($store = null): bool
+ {
+ return $this->legacyStockConfiguration->isDisplayProductStockStatus($store);
+ }
+}
diff --git a/vendor/magento/module-inventory-configuration/etc/di.xml b/vendor/magento/module-inventory-configuration/etc/di.xml
index 269616f24940..f6201230e799 100644
--- a/vendor/magento/module-inventory-configuration/etc/di.xml
+++ b/vendor/magento/module-inventory-configuration/etc/di.xml
@@ -14,6 +14,7 @@
+
diff --git a/vendor/magento/module-inventory-configuration-api/Model/InventoryConfigurationInterface.php b/vendor/magento/module-inventory-configuration-api/Model/InventoryConfigurationInterface.php
new file mode 100644
index 000000000000..72f4cc714cba
--- /dev/null
+++ b/vendor/magento/module-inventory-configuration-api/Model/InventoryConfigurationInterface.php
@@ -0,0 +1,121 @@
+getSourceItemBySourceCodeAndSku = $getSourceItemBySourceCodeAndSku;
$this->getStockItemConfiguration = $getStockItemConfiguration;
$this->getStockBySalesChannel = $getStockBySalesChannel;
$this->decrementSourceItem = $decrementSourceItem;
+ $this->inventoryConfiguration = $inventoryConfiguration;
}
/**
@@ -121,9 +130,17 @@ private function getSourceStockStatus(
): int {
$sourceItemQty = $sourceItem->getQuantity() ?: self::ZERO_STOCK_QUANTITY;
$currentStatus = (int)$stockItemConfiguration->getExtensionAttributes()->getIsInStock();
- $calculatedStatus = $sourceItemQty === $stockItemConfiguration->getMinQty() && !$stockItemConfiguration->getBackorders()
- ? SourceItemInterface::STATUS_OUT_OF_STOCK
- : SourceItemInterface::STATUS_IN_STOCK;
+ $calculatedStatus = SourceItemInterface::STATUS_IN_STOCK;
+
+ if ($sourceItemQty === $stockItemConfiguration->getMinQty() && !$stockItemConfiguration->getBackorders()) {
+ $calculatedStatus = SourceItemInterface::STATUS_OUT_OF_STOCK;
+ }
+
+ if ($this->inventoryConfiguration->isCanBackInStock() && $sourceItemQty > $stockItemConfiguration->getMinQty()
+ && $currentStatus === SourceItemInterface::STATUS_OUT_OF_STOCK
+ ) {
+ return SourceItemInterface::STATUS_IN_STOCK;
+ }
return $currentStatus === SourceItemInterface::STATUS_OUT_OF_STOCK ? $currentStatus : $calculatedStatus;
}