QUALITY PATCH

MDVA-41061: Stock status resets to saleable when the product is saved from the Admin

Stock status resets to saleable when the product is saved from the Admin. Quality patch MDVA-41061 for magento/module-catalog-inventory applies to Magento Open Source and Adobe Commerce 2.4.2 to 2.4.3-p3.

Categories
Inventory
Components
magento/module-catalog-inventory, magento/module-inventory-catalog, magento/module-inventory-configurable-product, magento/module-inventory-configuration, magento/module-inventory-indexer, magento/module-inventory-sales
Origin
adobe-commerce-support
Since QPT
1.1.5

Issue

Stock status resets to saleable when the product is saved from the Admin.

Steps to reproduce

1. Create a simple product with Qty = 1. 1. Place an order using the product created in step 1. 1. Run cron - make sure inventory.reservations.updateSalabilityStatus queue is executed and product stock status has been changed to zero in the cataloginventory_stock_status table. 1. Check product on the frontend. It should be marked as Out of Stock. 1. Save product in the Admin without any changes.

Adobe's page lists 2.4.2 - 2.4.2-p2, 2.4.3 - 2.4.3-p2 as compatible; the versions below are resolved from the current QPT constraints and are the ones the tool will offer.

Install

Install the Quality Patches Tool with composer require magento/quality-patches, apply the prerequisites listed for all files applicable to your distribution and version first, then run vendor/bin/magento-patches apply MDVA-41061. On Cloud, add MDVA-41061 under stage.build.QUALITY_PATCHES in .magento.env.yaml.

For cweagans/composer-patches, choose a compatible version below and download the bundle. Copy its MDVA-41061/ folder into patches/composer/, merge composer.patches.json into composer.json, then run composer install. Bundle prerequisites the same way and list them first. Paths are relative to each package root, using the default -p1 level. Prefer local files when configuring composer-patches; a remote URL can change.

Patch files and compatible versions

Packages across compatible versions (6): magento/module-catalog-inventory, magento/module-inventory-catalog, magento/module-inventory-configurable-product, magento/module-inventory-configuration, magento/module-inventory-indexer, magento/module-inventory-sales
Packages across compatible versions (6): magento/module-catalog-inventory, magento/module-inventory-catalog, magento/module-inventory-configurable-product, magento/module-inventory-configuration, magento/module-inventory-indexer, magento/module-inventory-sales

magento/magento2-base >=2.4.2 <2.4.3

Magento Open Source
2.4.2-p2, 2.4.2-p1, 2.4.2
Adobe Commerce
2.4.2-p2, 2.4.2-p1, 2.4.2
Replaced with
MDVA-41061-V2
Patch file
patches/os/MDVA-41061_2.4.2-p1_v2.patch
  • vendor/magento/module-catalog-inventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php
  • vendor/magento/module-catalog-inventory/Model/ResourceModel/Indexer/Stock/GetStatusExpression.php (added)
  • vendor/magento/module-catalog-inventory/Model/ResourceModel/Indexer/Stock/StatusExpression/DefaultExpression.php (added)
  • vendor/magento/module-catalog-inventory/Model/ResourceModel/Indexer/Stock/StatusExpression/ExpressionInterface.php (added)
  • vendor/magento/module-catalog-inventory/etc/di.xml

magento/magento2-base >=2.4.3 <2.4.4

Magento Open Source
2.4.3-p3, 2.4.3-p2, 2.4.3-p1, 2.4.3
Adobe Commerce
2.4.3-p3, 2.4.3-p2, 2.4.3-p1, 2.4.3
Replaced with
MDVA-41061-V2
Patch file
patches/os/MDVA-41015_2.4.3.patch
  • vendor/magento/module-catalog-inventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php
  • vendor/magento/module-catalog-inventory/Model/ResourceModel/Indexer/Stock/GetStatusExpression.php (added)
  • vendor/magento/module-catalog-inventory/Model/ResourceModel/Indexer/Stock/StatusExpression/DefaultExpression.php (added)
  • vendor/magento/module-catalog-inventory/Model/ResourceModel/Indexer/Stock/StatusExpression/ExpressionInterface.php (added)
  • vendor/magento/module-catalog-inventory/etc/di.xml

magento/inventory-metapackage 1.2.2

Magento Open Source
2.4.2-p2, 2.4.2-p1, 2.4.2
Adobe Commerce
2.4.2-p2, 2.4.2-p1, 2.4.2
Replaced with
MDVA-41061-V2
Patch file
patches/os/MDVA-41061_1.2.2_v2.patch
  • vendor/magento/module-inventory-catalog/Model/BulkInventoryTransfer.php
  • vendor/magento/module-inventory-catalog/Model/ResourceModel/StockStatusExpressionForDefaultStock.php (added)
  • vendor/magento/module-inventory-catalog/Model/SourceItemsSaveSynchronization/SetDataToLegacyCatalogInventory.php
  • vendor/magento/module-inventory-catalog/Plugin/CatalogInventory/Api/StockRegistry/AdaptUpdateStockStatusBySkuPlugin.php (added)
  • vendor/magento/module-inventory-catalog/Plugin/CatalogInventory/Api/StockRegistry/SetQtyToLegacyStock.php (added)
  • vendor/magento/module-inventory-catalog/Plugin/CatalogInventory/UpdateSourceItemAtLegacyStockItemSavePlugin.php
  • vendor/magento/module-inventory-catalog/etc/di.xml
  • vendor/magento/module-inventory-configurable-product/Plugin/CatalogInventory/Api/StockRegistry/SetQtyToLegacyStock.php (added)
  • vendor/magento/module-inventory-configurable-product/Plugin/CatalogInventory/Observer/ParentItemProcessor/AdaptParentItemProcessorPlugin.php
  • vendor/magento/module-inventory-configurable-product/etc/di.xml
  • vendor/magento/module-inventory-configuration/Model/LegacyStockItem/CacheStorage.php (added)
  • vendor/magento/module-inventory-configuration/Plugin/InventoryConfiguration/Model/GetLegacyStockItemCache.php
  • vendor/magento/module-inventory-indexer/Indexer/SelectBuilder.php
  • vendor/magento/module-inventory-indexer/Indexer/SourceItem/Strategy/Sync.php
  • vendor/magento/module-inventory-indexer/Indexer/Stock/PrepareReservationsIndexData.php (added)
  • vendor/magento/module-inventory-indexer/Indexer/Stock/ReservationsIndexTable.php (added)
  • vendor/magento/module-inventory-indexer/Indexer/Stock/Strategy/Sync.php
  • vendor/magento/module-inventory-sales/Model/ResourceModel/IsStockItemSalableCondition/IsStockItemSalableConditionChain.php
  • vendor/magento/module-inventory-sales/Model/ResourceModel/IsStockItemSalableCondition/MinQtyStockCondition.php
  • vendor/magento/module-inventory-sales/Model/ResourceModel/IsStockItemSalableCondition/ReservationsCondition.php (added)
  • vendor/magento/module-inventory-sales/etc/di.xml

magento/inventory-metapackage >=1.2.3 <1.2.4

Magento Open Source
2.4.3-p3, 2.4.3-p2, 2.4.3-p1, 2.4.3
Adobe Commerce
2.4.3-p3, 2.4.3-p2, 2.4.3-p1, 2.4.3
Replaced with
MDVA-41061-V2
Patch file
patches/os/MDVA-41015_1.2.3.patch
  • vendor/magento/module-inventory-catalog/Model/BulkInventoryTransfer.php
  • vendor/magento/module-inventory-catalog/Model/ResourceModel/StockStatusExpressionForDefaultStock.php (added)
  • vendor/magento/module-inventory-catalog/Model/SourceItemsSaveSynchronization/SetDataToLegacyCatalogInventory.php
  • vendor/magento/module-inventory-catalog/Plugin/CatalogInventory/Api/StockRegistry/AdaptUpdateStockStatusBySkuPlugin.php (added)
  • vendor/magento/module-inventory-catalog/Plugin/CatalogInventory/Api/StockRegistry/SetQtyToLegacyStock.php (added)
  • vendor/magento/module-inventory-catalog/Plugin/CatalogInventory/UpdateSourceItemAtLegacyStockItemSavePlugin.php
  • vendor/magento/module-inventory-catalog/etc/di.xml
  • vendor/magento/module-inventory-configurable-product/Plugin/CatalogInventory/Api/StockRegistry/SetQtyToLegacyStock.php (added)
  • vendor/magento/module-inventory-configurable-product/Plugin/CatalogInventory/Observer/ParentItemProcessor/AdaptParentItemProcessorPlugin.php
  • vendor/magento/module-inventory-configurable-product/etc/di.xml
  • vendor/magento/module-inventory-configuration/Model/LegacyStockItem/CacheStorage.php (added)
  • vendor/magento/module-inventory-configuration/Plugin/InventoryConfiguration/Model/GetLegacyStockItemCache.php
  • vendor/magento/module-inventory-indexer/Indexer/SelectBuilder.php
  • vendor/magento/module-inventory-indexer/Indexer/SourceItem/Strategy/Sync.php
  • vendor/magento/module-inventory-indexer/Indexer/Stock/PrepareReservationsIndexData.php (added)
  • vendor/magento/module-inventory-indexer/Indexer/Stock/ReservationsIndexTable.php (added)
  • vendor/magento/module-inventory-indexer/Indexer/Stock/Strategy/Sync.php
  • vendor/magento/module-inventory-sales/Model/ResourceModel/IsStockItemSalableCondition/IsStockItemSalableConditionChain.php
  • vendor/magento/module-inventory-sales/Model/ResourceModel/IsStockItemSalableCondition/MinQtyStockCondition.php
  • vendor/magento/module-inventory-sales/Model/ResourceModel/IsStockItemSalableCondition/ReservationsCondition.php (added)
  • vendor/magento/module-inventory-sales/etc/di.xml

Sources

Łukasz Bajsarowicz
Built by

Łukasz Bajsarowicz, e-commerce architect

Magento and Adobe Commerce architecture, upgrades, performance and audits for merchants and agencies since 2015; magento.watch is the tooling I use on those projects.

Open source, maintained on weekends.