Liquid, JavaScript, themes, sales channels
Hi,
Hope someone can also help me with the quantity selector.
I don't know why it accepts more than the inventory we have for a product.
Example: only available product is 4 but when customer clicks 5 on the quantity selector per product, it still accepts it upon checkout.
the website i'm working on is www.cornerhome.ph
Thank you!
Solved! Go to the solution
This is an accepted solution.
Hello,
Try this:
1. Go to your theme > Edit Code
2. Under the folder "section" find the file "product-template.liquid". Find the quantity box and add this code to it:
max="{{ product.selected_or_first_available_variant.inventory_quantity}}"
It should look something like this:
<input type="number" id="Quantity-{{ section.id }}" name="quantity" max="{{ product.selected_or_first_available_variant.inventory_quantity}}" value="1" min="1" class="product-form__input" pattern="[0-9]*">
If you have variants then you have to change max value using Javascript, in this case it would require hiring a Shopify developer to assist you.
Kind regards,
Diego
This is an accepted solution.
Hello,
Try this:
1. Go to your theme > Edit Code
2. Under the folder "section" find the file "product-template.liquid". Find the quantity box and add this code to it:
max="{{ product.selected_or_first_available_variant.inventory_quantity}}"
It should look something like this:
<input type="number" id="Quantity-{{ section.id }}" name="quantity" max="{{ product.selected_or_first_available_variant.inventory_quantity}}" value="1" min="1" class="product-form__input" pattern="[0-9]*">
If you have variants then you have to change max value using Javascript, in this case it would require hiring a Shopify developer to assist you.
Kind regards,
Diego
I followed these directions (and thank you so much for the help!) but the quantity doesn't change when I select a different variant.
All it does is copy the amount from the first variant or the first selected variant.
Hopefully this makes sense.
Any suggestions?
Having something similar for the check-out page would be nice too.
I wish this was built into the Brooklyn Theme.
Hello Diego,the solution you provided should be for every theme?
I tried to apply it but selector is 'infinite' and it doesn't stop at the actual available inventory quantity. For a check, website is sfusobuono.com
thanks a lot for a feedback
Hello @rheabue
If you want to limit the product qty
Please check out this app
https://apps.shopify.com/purchase-limit?
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024