Skip to main content
Tweeted twitter.com/StackMagento/status/787924950401294337
edited tags
Link
Rakesh Jesadiya
  • 42.4k
  • 19
  • 132
  • 184
Source Link
Fred August
  • 922
  • 14
  • 26

How to get quantity of simple product on configurable product page

I'm searching the way to preload quantity of each simple product on configurable product detail page. The reason is I want to dynamically show to client "In Stock", "Out of stock" or "Only 1 left" notification for each size+color config which was selected by client.

P.S.: I used color swatches as dropdown and I saw one hidden field which was dynamically change with selected simple product ID. But then I changed to text swatch+image swatch and this field no more changing.

Can anybody show example how to implement this functionality in Magento 2? Thank you