Magento2: Confiurable product is In stock even though all child in out of stock

Created on 27 Mar 2018  Â·  8Comments  Â·  Source: magento/magento2

Configurable product is showing IN STOCK but all child are in out of stock in default setup of Magento 2.2.1

Preconditions


  1. MAGENTO 2.2.1
  2. 2.

Steps to reproduce

  1. Create configurable Product with two child.
  2. keep one child out of stock and another with 1 QTY
  3. Place order with second child . once order get placed successfully all child will be out of stock even though Parent product Stock status will be as IN STOCK.

Expected result

  1. Parent Product should be OUT OF [STOCK]

Actual result

  1. showing Parent Product IN STOCK

Cannot Reproduce Format is valid needs update

Most helpful comment

Hello Magento/Magento2,

Greetings from FundsIndia!

A wonderful friend of you "Pramod([email protected])" referred your name as a person who would be interested in our services.

We are an exciting new online platform for investment services in India. We provide a variety of investment products on our platform - schemes from 35 mutual fund companies, deposits from 6 corporates and more!

All our mutual fund and deposit services are offered fully free of cost - no account opening fees, no transaction charges or account maintenance charges!

We welcome you to open an account with us by clicking on the link below:
Click here to open a free account

If you have any questions, please write to us at [email protected], or call us at +91-44-43443100.


Regards,

FundsIndia Team.

All 8 comments

Place order with second child . once order get placed successfully

Did you assure indexers finished their work after such placement?

Yes! I did indexing also but no success.

@pramodkharade , thank you for your report.
We were not able to reproduce this issue by following the steps you provided. Please provide more detailed steps to reproduce or try to reproduce this issue on a clean installation or latest release.

Configurable product
conf1

Child products
conf_child

Child in stock with quantity 1
conf_child_in_stock

Child out of stock
conf_child_out_of_stock

Add to cart more than one with error message, not placing order
add_more

Place order
order_conf

Product status after placing order
after_plasing order

Hi Team,

I have tested pure default setup.

1.Child on OutOfStock:

​
2.Child after Order placed: Out Of Stock

​3. Still Parent Product Status is

In Stock
​parent product should be* out of stock* at catalog but it is showing

  • IN Stock.*

and it showing Out Of stock at front-end.

--
Thanks And Regards
Mr.Pramod K.Kharade

Software Engineer *
*Mobile: +91 9623014150 Email:
[email protected]
[email protected]

On 27 March 2018 at 19:22, Magento Community Engineering <
[email protected]> wrote:

@pramodkharade https://github.com/pramodkharade , thank you for your
report.
We were not able to reproduce this issue by following the steps you
provided. Please provide more detailed steps to reproduce or try to
reproduce this issue on a clean installation or latest release.

Configurable product
[image: conf1]
https://user-images.githubusercontent.com/31669971/37971100-d1750c2c-31dd-11e8-930e-73ac1fcee003.png

Child products
[image: conf_child]
https://user-images.githubusercontent.com/31669971/37971150-e8cc42fa-31dd-11e8-886e-0a27dc723b1e.png

Child in stock with quantity 1
[image: conf_child_in_stock]
https://user-images.githubusercontent.com/31669971/37971177-fb9129dc-31dd-11e8-9958-5897e8e9755d.png

Child out of stock
[image: conf_child_out_of_stock]
https://user-images.githubusercontent.com/31669971/37971207-0c94c392-31de-11e8-9b2e-d3b3915644f6.png

Add to cart more than one with error message, not placing order
[image: add_more]
https://user-images.githubusercontent.com/31669971/37971345-615037b8-31de-11e8-9c40-96437115a9f8.png

Place order
[image: order_conf]
https://user-images.githubusercontent.com/31669971/37971414-8a490b04-31de-11e8-8070-eb17610cd4e5.png

Product status after placing order
[image: after_plasing order]
https://user-images.githubusercontent.com/31669971/37971468-adc28cea-31de-11e8-9d13-7615c867a444.png

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/magento/magento2/issues/14389#issuecomment-376532886,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AH0GtZk4HRqoAa-gARl1PrGHl34rdUAEks5tikQigaJpZM4S8oy_
.

In M1 at least, I'm 99% sure that there is no attempt to update the "stock status" field on a configurable when it's last simple goes out of stock. It was my understanding the justification for this was so that you could manually control the saleability of the configurable regardless of the simples stock level. So this would be considered "Works as designed". Checking availability of a configurable should therefore be done with the isAvailable / isSalable methods rather than checking the stock status directly (which is why the previous testers screen shot shows Out of stock).

@pramodkharade, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.

Hello Magento/Magento2,

Greetings from FundsIndia!

A wonderful friend of you "Pramod([email protected])" referred your name as a person who would be interested in our services.

We are an exciting new online platform for investment services in India. We provide a variety of investment products on our platform - schemes from 35 mutual fund companies, deposits from 6 corporates and more!

All our mutual fund and deposit services are offered fully free of cost - no account opening fees, no transaction charges or account maintenance charges!

We welcome you to open an account with us by clicking on the link below:
Click here to open a free account

If you have any questions, please write to us at [email protected], or call us at +91-44-43443100.


Regards,

FundsIndia Team.

if all simples and configurables are out of stock.
In admin you put simple in stock manually
run the indexes
it does not put configurable back in stock

see \Magento\ConfigurableProduct\Model\ResourceModel\Indexer\Stock\Configurable::_getStockStatusSelect()

And code

$statusExpr = $this->getStatusExpression($connection);
$optExpr = $connection->getCheckSql("le.required_options = 0", 'i.stock_status', 0);
$stockStatusExpr = $connection->getLeastSql(["MAX({$optExpr})", "MIN({$statusExpr})"]);

statusExpr has configurable product status, while optExpr has its simple stock status

stockStatusExpr is least of these two, which means if configurable is out of stock at any point, adding stock in simple and running indexes won't bring back configurable product back in stock

Was this page helpful?
0 / 5 - 0 ratings