2

After migration all product showing out of stock

  • what is the issue here? what you are trying to do? – jafar pinjar Aug 26 '19 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 kalal Aug 27 '19 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 pinjar Aug 27 '19 at 7:00
  • 1
    yes i have solved this error and shared my solution here hope this solution will help someone – Vikas kalal Aug 27 '19 at 7:06
  • That's good!!, Great to hear you resolved it! – jafar pinjar Aug 27 '19 at 7:16
5

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 :) – Prashant Aug 4 '20 at 17:46
  • Hello, I tried this SQL but I got error #1062 - 'default-757614000000' 'INVENTORY_SOURCE_ITEM_SOURCE_CODE_SKU' - duplicate entry – Gustavo Ulyssea Sep 18 '20 at 23:19
  • @GustavoUlyssea You need to truncate table inventoty_source_item and then run the query. – Pavel Panchyshnyy Oct 9 '20 at 10:33
0

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 !!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.