Limit Quantity Selector

Highlighted
Tourist
7 0 11

Apologies if this has been answered but I can't seem to find it.

 

Using the Pop theme I have enabled the Product Quantity selector. As it is currently programmed, a customer can select an infinite qty and only on the cart page are they notified that the qty they selected is unavailable and it will need to be reduced. My expectation of functionality would be that if a variant has an available qty of 4 that the qty selector would max out at 4 and not allow the customer to select a qty of 5+ before clicking add to cart. Shopify support says Development is "aware" of this. Thanks in advance!

Highlighted
Shopify Expert
3903 559 938

Hi @Walker_Edwards 

Follow this:

1. Section -> product-template.liquid -> find your quantity box and add bellow code:

max="{{ product.selected_or_first_available_variant.inventory_quantity}}"

So it look like something:

<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 Js from Asset->theme.js from variants select callback function.  find if(variants)

Want to modify or custom changes on store hire me.
Want to give Gift for time? its my Paypal too.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com Or WhatsApp
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
Highlighted
Shopify Staff
Shopify Staff
351 39 80

Hey, @Walker_Edwards!

 

My name is Lilith, I'm on the Social Care team at Shopify.

 

The above answer from @Jasoliya will work excellently! I also wanted to drop a few screenshots of how Pop works for limited quantities.

 

Pop Theme notification

 

It does have a notice on the Product Page before going to the Cart Page where the customer can have a limit of how many items they can add to the cart.

If you have Shopify tracking your inventory this is what it'll look like.

 

This is the inventory set at 10 maximum on a test store for these variants:

 

 

alt

 

 

When viewing the site, this is what happens if more than the maximum is selected:

 

 

alt

 

 

It shouldn't allow the customer to add the item to the cart. If this isn't happening on your site, there could be some custom code that could be interfering with it. The other reason this might not show up is if your theme is not up to date. In the latter case, I'd recommend downloading a fresh copy of the theme and adding your customized visuals to it if you haven't had too many customizations to the theme, this will usually help solve several things for merchants.

 

Showing Inventory Left In Stock

 

Another helpful option that I've used frequently in my own stores is to add a snippet to the product page as well to let customers know how much is left in stock.

 

Here's the snippet I used on any Pop theme:

 

 <div>{{ variant.inventory_quantity }} left in stock</div>

 

You can add it anywhere in the Section called product-template.liquid, but here's where I normally placed it:

 

 

alt

 

 

Of course, you can add styles to it and change the font format and much more, but for the purposes of simplicity, I've left it plain here.

Here's what it looks like on the site:

 

 

alt

 

 

Some other options

 

I've got a couple of apps that can do a similar display of in-stock numbers as well if you'd like to check them out.

 

I do like using a display of inventory on products even if a maximum quantity is limited on the page. This display of stock count helps drive a bit of urgency and can really boost conversions in the long run as well. I love using it, but this is just an option and an idea that might help as well.

 

Here are the apps that can help with this if you don't want to modify the code:

 

 

Let me know how you do with the information above! I'm happy to answer any questions you think of as you work on your business.

Lilith | Social Care @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Highlighted
Tourist
3 0 3

Thanks @Jasoliya for the answer to the previous question!  I was able to implement it for singular products, but was unable to figure out how/where/what code to write  to update product variant max quantities on the product page.  Would you be able to instruct me how to do this for variants in the Debut template, please?  I searched in Js for "if (variant)" but I've really no idea what to do. 

Highlighted
Shopify Expert
3903 559 938

What you want to do exact? 

Want to modify or custom changes on store hire me.
Want to give Gift for time? its my Paypal too.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com Or WhatsApp
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes
Highlighted
Tourist
3 0 3

I have products with multiple variants, and would like to set the max quantity for each variant on the product page quantity selector.  So if a customer chooses a variant, they are able to select the maximum quantity of that variant, and not be given the option to select a higher number. 

Highlighted
Shopify Expert
3903 559 938

Then you have to manage it by Js code.

you have to get qty from variant callback function and then place as MAX attribute in qty selector so user can not ad more MAX qty. 

You can fine if(variant) in theme.js file, where you can get variant object in Js

Want to modify or custom changes on store hire me.
Want to give Gift for time? its my Paypal too.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com Or WhatsApp
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
Highlighted
New Member
1 0 0

Saraht, i have the same problem? Did you fix it? Can you help?


@saraht wrote:

I have products with multiple variants, and would like to set the max quantity for each variant on the product page quantity selector.  So if a customer chooses a variant, they are able to select the maximum quantity of that variant, and not be given the option to select a higher number. 





 

0 Likes
Highlighted
Tourist
3 0 3
Unfortunately, no, I didn't fix it. I don't know anything about coding, so
I'll have to hire someone to do it for me, if I want it done, because I
couldn't figure it out. I tried and failed.
0 Likes
Highlighted
Tourist
9 0 3

Can anyone help me with this? The two things I'd love to have on my site, mind you I can copy and paste code into a certain spot if directed exactly but that is the limit on my coding ability. 

1. Need quantity available on products for EACH VARIANT shown on the product pages for customers. Preferably BELOW where they select the quantity they are going to purchase. 

2. Need a customer to only be able to add what is available in stock for a item to their carts. NO I do not want them to add it to their cart and then get an error at checkout. NO I do not want them to go over the amount available and then get an error below on the product page saying they can't add said item to their cart. It doesn't explain to them why and they might think the item is out of stock. Both of those instances are frustrating for customers and we could loose the sale. 

I can't believe these two items are not standard on any Shopify theme since they are standard everyday things needed to sell retail. 

Thank you in advance to anyone who can help since I have been hunting for the solution since launching my site. 

My theme is Minimal and the website is www.ciaobellaboutique.shop

0 Likes