inventory: Configurable products marked out of stock incorrectly
Preconditions (*)
- Non-default inventory source and stock has been set up
- Configurable product set up with one or more simple products
- Simple products are all out of stock at
defaultsource - At least one simple product in stock (with plenty of stock) at other sources
Steps to reproduce (*)
- Create and ship an order with a configurable product using a source other than the default source.
- Wait for stock reindexing and check the salable status of the configurable product
Expected result (*)
- Configurable product remains salable, as simple products are still salable at non-default sources
Actual result (*)
- Configurable product is marked as not salable
Additional information
I believe this is caused by https://github.com/magento/inventory/blob/e08a47c3501de2cbff42b3ac05058ce15d620e75/InventoryConfigurableProduct/Plugin/InventoryApi/UpdateParentStockStatusInLegacyStockPlugin.php
This plugin updates the status of configurable products based on the stock status of their simple components, but it does not take the inventory setup into account at all. In our case, the default source has not been updated at all, yet the result is that the cataloginventory_stock_item table is updated for the configurable product. As a result of this, the inventory stock indexer takes this changed value into account and subsequently marks the configurable as not salable for any non-default stocks.
There is an additional plugin https://github.com/magento/inventory/blob/e08a47c3501de2cbff42b3ac05058ce15d620e75/InventoryConfigurableProduct/Plugin/InventoryApi/UpdateConfigurableProductParentStockStatus.php that was added later that appears to be for much the same purpose, but with additional checks that single source mode and a single store are being used.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 11
- Comments: 19 (1 by maintainers)
Hello,
I got the same issue on my side. I temporary created this patch : AC_FIX_INVENTORY_CONFIGURABLE_STOCK_2.4.5.patch.txt
That patch seems to be working perfectly on 2.4.4 as well. Thanks!
@RonanCapitaine are you able to raise a PR with your changes so that Magento / Adobe can review this and merge it in for the next release? That would help us all! Really appreciate your efforts.
Experienced the same. Below patches didn’t solve the issue. Any recent update? MDVA-41061-V4 and ACSD-45488
Hello, I have a temporal solution that is working for me. We are override \Magento\ConfigurableProduct\Model\Inventory\ChangeParentStockStatus The problem is the variable $childrenIsInStock is initialized a false and then never change the value. We are calculated the value of this variable with the sum of sources quantities. This is incorrect if you use stock for websites, but this is a fastest solution for us to resolve the problem in production environment. This is my function processStockForParent
This issue also exists for bundled products
After shipment, the configurable product goes OOS just because of https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/ConfigurableProduct/Model/Inventory/ChangeParentStockStatus.php#L100. 2.4.4 introduced with https://github.com/magento/inventory/blob/e08a47c3501de2cbff42b3ac05058ce15d620e75/InventoryConfigurableProduct/Plugin/InventoryApi/UpdateParentStockStatusInLegacyStockPlugin.php. When you have more than one source, cataloginventory_stock_item table stock status never update and your entire things will broken. Made adjustment with MSI like @IvanVizcaino did.
Seems like it wasn’t solved. Still experiencing an issue with it. Configurable goes OOS