After migration all product showing out of stock
-
what is the issue here? what you are trying to do?– jafar pinjarAug 26, 2019 at 12:23
-
The issue that after migration all product show out of stock even it has been assigned stock quantity . so after running this query your out of stock issue will be finshed– Vikas kalalAug 27, 2019 at 6:30
-
so is any issue here? I think u resolved it by yourself, what is the question here?Are you seeking for any help?– jafar pinjarAug 27, 2019 at 7:00
-
1yes i have solved this error and shared my solution here hope this solution will help someone– Vikas kalalAug 27, 2019 at 7:06
-
That's good!!, Great to hear you resolved it!– jafar pinjarAug 27, 2019 at 7:16
2 Answers
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.
-
Thanks for sharing this Vikas, it really helped. And worked in Magento 2.4 :)– djmzfKnmAug 4, 2020 at 17:46
-
Hello, I tried this SQL but I got error #1062 - 'default-757614000000' 'INVENTORY_SOURCE_ITEM_SOURCE_CODE_SKU' - duplicate entry Sep 18, 2020 at 23:19
-
@GustavoUlyssea You need to truncate table
inventoty_source_item
and then run the query. Oct 9, 2020 at 10:33 -
Hello, I have same issue, I tried above sql, did reindex but still same all the products are showing out of stock. Apr 29, 2021 at 11:49
-
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 !!!