After migration all product showing out of stock
Try backup the
inventory_source_item table and use the below query:
insert into `inventory_source_item` (source_code, sku, quantity, status) select 'default', sku, qty, stock_status from (`cataloginventory_stock_status` as `lg` join `catalog_product_entity` as `prd` on((`lg`.`product_id` = `prd`.`entity_id`)))
Please take backup before running this query in your Database.
Dude, you really helped us with this. Had same problem, we were searching all day and this helped a lot.
Our problem was that Amasty Custom stock status was not always showing the correct custom stock status rules. So sometimes it did, sometimes not. So if things were in stock it said out of stock, and for products out of stock it showed in stock.
We had to truncate the table first and ran the query.
Thanks for sharing, hope other will help.
It was after a migration from magento 1 to magento 2.
So hope this will help others !!!