Hello,
I use many configurable products.
There are 2 sources (other than default) and there is also other than default
All child products use the custom stock and sources (not the default one).
After reindexing all configurable products are set to Out of Stock.
When looking to table 'inventory_stock_2' in the database, there are many items where quantity>0 and is_salable=0. Well, all confugirable products.
If I update this in the database
UPDATE inventory_stock_2 SET is_salable=1 WHERE quantity>0 and is_salable=0;
then all products are normally displayed in the store, but next reindexing change stock status back to Out of Stock.
All child simple products have always correct stock status.
This problem occured only about 2 weeks ago, but I cannot say what preceded this issue.
I did some product updates via Magento Import and also I tested some product imports via REST API and unfortunatelly I was stupid enough to run at least some tests on production version, even if I have also test environment.
Later I notice not just this issue, but also 'Default stock' was added to all products. I have manually deleted the Default Stock from the products, but the problem with stock status still persists.
How can I fix this or check where the problem is?
(Magento 2.4.3-p1)
Thanks
Solved! Go to Solution.
At the end I learnt that all configurable products where somehow set as Out Of Stock.
The only way how to mass change the status I found was following SQL query:
UPDATE cataloginventory_stock_item INNER JOIN catalog_product_entity ON product_id=catalog_product_entity.entity_id SET is_in_stock = 1 WHERE type_id="configurable";
Hello @Peter_Karak,
Greetings to you!
If you ever find a Magento shopping cart is erroneously showing ‘in stock’ items as being ‘out of stock’ and you have ‘Manage Stock‘ set to ‘yes‘ under System > Configuration > Catalog > Inventory then you have probably hit a bug in Magento.
At the end I learnt that all configurable products where somehow set as Out Of Stock.
The only way how to mass change the status I found was following SQL query:
UPDATE cataloginventory_stock_item INNER JOIN catalog_product_entity ON product_id=catalog_product_entity.entity_id SET is_in_stock = 1 WHERE type_id="configurable";
Thanks for your suggestion. Not sure it was my case. I learnt all my configurable products were for some strange reason set as Out Of Stock. Once I changed all of them to In Stock, everything works as expected. I managed to do it via SQL. otherwise it would not be possible due to large number of products