How can I accurately display stock quantity for product variants using JS?

Hello,

I have a little problem with our product page. Use the prestige theme.

It’s about the correct display of stock for articles with variants. If I click on another variant, the quantity that is displayed does not change. This has to be read with JS, I already know that so far. I just don’t understand how to do it yet.

I let the stock amount be spent as follows

Only {{ product.selected_or_first_available_variant.inventory_quantity }} pieces available

How would I best program this, hope you can help me.

greeting
Marco

Hi @MarcoAP

I have checked the prestige theme and found that in the prestige theme by default the inventory code is working properly on variant change.

Also, make sure that you have set the inventory threshold to 0 as shown in the given video. If it’s set to zero and then also you are facing the issue then I guess you have messed up the code so it is not working in your theme.

I have understood your concern. Please send me your store Url so I can check and let you know why it’s happening. Also, if everything is perfect from the URL then for giving you a better solution I need to check your theme’s javascript code.

Please check attached video for a prestige theme inventory work.