Quantity Selector and Max Limit for Brooklyn Theme

Solved
Highlighted
Tourist
18 0 1

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!

0 Likes
Highlighted

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

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Needing urgent help? I am currently available for hire, same day response guaranteed: diego.boarutto.fortes@gmail.com
0 Likes
Highlighted
Tourist
18 0 1

It worked! Thanks, @diego_ezfy 

0 Likes
Highlighted
New Member
4 0 0

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?

0 Likes
Highlighted
New Member
4 0 0

Having something similar for the check-out page would be nice too.  
I wish this was built into the Brooklyn Theme.

0 Likes