Can anyone explain why exactly a configurable product for which every virtual product's quantity goes down to zero, and said product subsequently disappears from the store, won't come back even if the quantities are brought back to >0 by hand and the status is specifically set to "in-stock"? This is related to Configurable product still out of stock even after child product is back in stock but there was no definitive answer to that one.

We're doing POST requests to create new products and reconfigure existing ones. So essentially it goes like this:

  1. There's a product with 3 sizes, sizes L and S are out of stock with quantity = 0, size XXL is in stock and quantity = 1.
  2. POST all virtual products, POST the main product
  3. Observe that the product appears in the store with sizes dropdown listing all three sizes (that's strangeness #1 as only one size should be seen in the dropdown)
  4. POST a virtual product of size XXL with quantity = 0
  5. Observe that the product has disappeared from the store as expected
  6. POST the same virtual product with quantiy = 1 and is_in_stock = true
  7. Observe how those parameters have changed in admin accordingly and the product is marked now as "in stock", also observe how the product hasn't re-appeared in the storefront regardless of that

Worse yet, you can't just delete those 4 products and re-POST them again, because they won't appear. What you have to do is

  1. Delete the products
  2. Do a reindex
  3. POST the products again

Reindexing without deleting and re-POSTing changes nothing - the product still won't appear.

Moreover, if you make an SQL dump of the state when the product shows up on the storefront, then make it go out of stock, clear the database and restore from that backup, the product still won't appear, meaning the problem concerns not only the database data, but also Elasticsearch indexes, and fixing just one of those two doesn't work.

Now can someone explain to me why that happens at all and if there's a way to make the products re-appear after a POST request makes a product available again. I've tried disabling stock managing but that simply makes products always show regardless of their status, i.e. not what we need.

Also of note is the strange behavior of the sizes dropdown just after POSTing - normally if you have a product with all sizes in stock and start to gradually order them so they go out of stock one size after another, the dropdown would react accordingly and filter out those out-of-stock sizes. Still it does display out-of-stock sizes right after the new product is created via POST.

Am I right by choosing type_id=virtual to provide size options and quantities of physical products such as clothes?

Maybe there's a way to debug this somehow.

1 Answer 1


Solved by adding

"use_config_manage_stock": false,
"manage_stock": true,

to the product's JSON and reindexing after going from >0 to 0 in total quantities.

Somehow even though Manage Stock is explicitly set to Yes in Admin, this setting is ignored.

The key is updating stock_status row in cataloginventory_stock_status table for the product. If you do POST requests for the base product even with qty>0 and is_in_stock=true but without the two abovementioned parameters, the cataloginventory_stock_status table will never get updated and the product will always be marked as out of stock in that particular table which in turn makes it never show in the storefront unless you opted to display out of stock products.

To avoid reindexing the following procedure must be followed:

  1. POST all linked virtual products (hides the product when going from ≥1 to 0)
  2. POST base product
  3. POST all linked virtual products again (last two show the product when going from 0 to ≥1)

So it's fine to make all three requests every time as that covers every case.

Digging deeper into this would be a bit too much for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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