Magento2: products became “out of stock” after update from 2.0.7 to 2.1.0

Created on 24 Jun 2016  ·  22Comments  ·  Source: magento/magento2

After updating from 2.0.7 to 2.1.0 all the products in catalog became "out of stock". That's how they displaying in my bestseller widget.
But in admin panel they always have positive quantity, so they have to be "in stock".
And, of course, they are invisible at frontend catalog.

UPD: Only when I'm adding a new product it appears at catalog, but no changes with already existed catalog products. indexer:reindex doesn't solve the problem with existed products.

Why is that so and how to fix that?

Setup Ready for Work bug report

Most helpful comment

Hi,
this issue was already fixed and will be delivered soon,
for now you can use quick fix :
Run MySQL query update cataloginventory_stock_item set website_id = 0 where website_id = 1;
and then run in CLI php bin/magento index:reindex cataloginventory_stock.

All 22 comments

@antonlazarchenko
Thank you for reporting this issue!
Please, provide description according to the template.

@andimov , I run site at localhost under windows 7, using xampp with php 7.0.6 required for magento 2.1.0.
I did following:

  1. Change magento community edition version inside composer.json from 2.0.7 to 2.1.0
  2. composer update
  3. bin/magento setup upgrade
    I saw that frontend product catalog is empty, but I added some products before updating magento so they should be at frontend product catalog. At admin product catalog they were present and everything seems correct (enabled, quantity at stock is podivite value)
    Then I did this step
  4. bin/magento indexer:reindex
    Nothing changed inside product catalog.
    Then I tried to create new product via admin and it was successfull. New product appeared at frontend catalog.
    But old ones still didnt show.

What else can I describe?

@antonlazarchenko
Thank you for more detailed description.
Please specify MySQL engine and version. (You can also check System Requirements)

@andimov here it is:

Server: Localhost via UNIX socket
Programm: MySQL
Version: 5.5.29 - MySQL Community Server (GPL)
Protocol version: 10
Server encoding: UTF-8 Unicode (utf8)

System requirements is ok including php version 7.0.6.

@antonlazarchenko
MySQL 5.6 is requirement for Magento 2, probably your problem caused by this.

@andimov sorry, it was a mistake caused bad version of mysql client.
The real MySQL version is 5.7.11.
So we can exclude version factor.

Same problem here after upgrading from Magento 2.0.7 to 2.1.0, note that my Magento 2.0.7 had products imported from a 1.7.0.2 database using data-migration-tool.

After following steps below all my products show as 'out of stock' and don't show up in categories:

../composer/composer.phar require magento/data-migration-tool:2.1.0 --no-update
../composer/composer.phar require magento/product-community-edition 2.1.0 --no-update
php bin/magento setup:upgrade
php bin/magento cache:clean
php bin/magento indexer:reindex

I have MySQL 5.6.3 running on localhost.

I can still see the products when I visit product pages directly but can't order these products as they are out of stock. On Magento 2.0.7 all products were visible & purchasable. Note that I have Configuration -> Catalog -> Inventory -> Manage Stock set to "No" and Display Out of Stock Products set to "Yes".

Note that I was suffering from the issues described in https://github.com/magento/magento2/issues/5236 and had to remove all items from catalog_product_entity_varchar attribute_id=111 to work around the following error: Notice: Undefined offset: 111 in /vendor/magento/module-eav/Model/ResourceModel/ReadHandler.php on line 166

mysql> delete from catalog_product_entity_varchar where attribute_id=111;
Query OK, 7890 rows affected (0.11 sec)

Wondering if this could be the root cause of this next issue...
@andimov: any chance that you had to do the same?

FWIW: noticed that quantity_and_stock_status attribute was (no longer?) part of the Migration_Default attribute set, so couldn't see stock information on product pages on backend. After manualling adding the quantity_and_stock_status attribute to the Migration_Default attribute set I can see all products in backend as "In Stock" but on frontend they still show "Out of Stock". I also can't seem to change the value of quantity_and_stock_status in backend (when I change a product to "Out of Stock" the page reloads and shows "In Stock" again).

Can someone tell me what SQL query I can execute to show stock status of products?

In my case I solved problem by changing website_id to 0 in cataloginventory_stock and then I did reindex.

@DmytroRevischuk thank you for solution!
@antonlazarchenko @flecxie please, check this solution for your issues.

@andimov unfortunatelly it doesn't work for me. I already had website_id=0, so there was nothing to change.
image

@DmytroRevischuk thanks, this fixed my problem!

mysql> select * from cataloginventory_stock;
+----------+------------+------------+
| stock_id | website_id | stock_name |
+----------+------------+------------+
|        1 |          1 | Default    |
+----------+------------+------------+
1 row in set (0.00 sec)

mysql> update cataloginventory_stock set website_id=0 where stock_id=1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

@antonlazarchenko Did you use the migration tool in this installation?

@andimov no, I didn't. Is that necessary for upgrade from 2.0 to 2.1?

Hi @antonlazarchenko

Thank you for reporting.
We've created an internal ticket MAGETWO-58134 to resolve this issue.

Hi,
this issue was already fixed and will be delivered soon,
for now you can use quick fix :
Run MySQL query update cataloginventory_stock_item set website_id = 0 where website_id = 1;
and then run in CLI php bin/magento index:reindex cataloginventory_stock.

@DmytroRevischuk @andimov
I had this problem after updating from Magento 2.1 to Magento 2.1.1 (didn't had the problem after migrating from 2.0 to 2.1 btw).

Your solutions worked perfect for me as well. Thank you.

Do you think i have to run also
delete from cataloginventory_stock_status where website_id = 1;
?

Hi @LucScu ,
it is not necessary to delete records from cataloginventory_stock_status table. Run reindex is enough.
This issue is closed as resolved.

Also after run reindex products with website = 1 remains in cataloginventory_stock_status

I solved just doing a php bin/nagento inderxer:reindexer in terminal

@vihuarar you made a mistake.
Your solutions worked perfect but not php bin/nagento inderxer:reindexer .
It will be right php bin/magento indexer:reindex .

Was this page helpful?
0 / 5 - 0 ratings