Solved

Quantity Selector and Max Limit for Brooklyn Theme

rheabue
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!

Accepted Solution (1)

diego_ezfy
Shopify Partner
2958 568 891

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

View solution in original post

Replies 6 (6)

diego_ezfy
Shopify Partner
2958 568 891

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

rheabue
Tourist
18 0 1

It worked! Thanks, @diego_ezfy 🙂

KimmieH
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?

KimmieH
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.

sfusobuono
Tourist
8 0 1

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

 

magecomp
Shopify Partner
264 20 32

Hello @rheabue 

If you want to limit the product qty
Please check out this app

 

https://apps.shopify.com/purchase-limit?

 

Helping voluntarily. Please like and accept the solution if it helps. Thanks!
Our Bestseller Shopify Apps    |      Mobile App Builder by MageComp    |      Limit Qty Purchase

Need a developer?  Just visit MageComp website