I have added a line on my product page that tells the inventory remaining if the quantity goes below 6. I have been able to update that when I have variants as well. I had to use a bit of code I found because it looks like variant.inventory_quantity wasn't defined. (Confession - I have a decent amount of coding experience in other languages, but not java or liquid, so please excuse if I misspeak on something!) Now I am trying to control the maximum number available to match the actual inventory when a customer chooses a different variant. For example, I have 2 in stock for the first variant, but 7 in stock for the second. But when I switch to the second variant, the quantity selector will only let me choose 2. I have product.selected_or_first_available_variant.inventory_quantity as my max value for the quantity selector. I'm sure I'm not providing enough information, but can someone offer some direction?
Hi there! Sean from Shopventory here. We're an inventory and reporting app for Shopify and here's our listing.
Is the maximum you're referring to something you'd like the customer to see on the front end when purchasing, or is this on the backend for you to be reporting on?
We have minimum/maximum levels in our app, but they don't display to the customer.
Thanks in advance for the clarification!
I've been able to display the number for the customer to see. It updates when the variant changes. But the quantity selector does not update. I have it set as the first selected on the product template page. But I don't know how to update this in java in the theme.js code. Or if that's even what I need to do. But as it stands now, the inventory quantity of the first variant sets the number that the person can order or any other variants. Regardless of how many are available in the actual inventory for that variant.