All things Shopify and commerce
I have keyfob wristlets listing in my store with 11 variants. I have the stock set to what I have on hand in the backend, but when I test on the front end I'm able to add way more quantity than what is available. I do see an error message come up that says "You can't add more *PRODUCT NAME* to the cart" but it doesn't alert the customer of what the actual amount is on hand.
How can I keep customers from adding more of one item in the cart that exceeds the quantity on hand, and/or how can I show the customer the exact quantity on hand?
Solved! Go to the solution
This is an accepted solution.
Pls follow below steps to set limit to your quantity picker
1. Open your theme code editor
2. Find the file main-product.liquid in the sections folder and open it.
3. Find the quantity-input code here
4.Copy below code and add the two attribute to the quantity-input box.
max="{{ product.selected_or_first_available_variant.inventory_quantity }}"
data-max="{{ product.selected_or_first_available_variant.inventory_quantity }}"
Hope this helps
Hey @mooncabinshop
There are a few reasons why you could be experiencing overselling. Could you please check the following:
Ensure that inventory tracking is enabled for your products.
Go to your Shopify Admin > Products > Select the product > Inventory.
Check the box for "Track quantity."
In the same Inventory section, make sure the "Continue selling when out of stock" option is unchecked. This will prevent customers from purchasing more than what is available.
Let me know how you get on!
Moira | 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
I double checked all the variants and they are checkboxed properly, so I'm not sure what's causing the issue (I'm running Studio v15).
I am not sure which theme you are using?
But I have a check on the dawn theme.
We can add a block on the product template to display inventory quantity. Pls have a check if you have similar block.
I'm using the Studio Theme. I found the inventory block and added it advice the quantity picker. It's a start, but I would really want that quantity picker to stop at the quantity on hand and go no further.
Thanks!
This is an accepted solution.
Pls follow below steps to set limit to your quantity picker
1. Open your theme code editor
2. Find the file main-product.liquid in the sections folder and open it.
3. Find the quantity-input code here
4.Copy below code and add the two attribute to the quantity-input box.
max="{{ product.selected_or_first_available_variant.inventory_quantity }}"
data-max="{{ product.selected_or_first_available_variant.inventory_quantity }}"
Hope this helps
Worked like a dream - thank you!
Thank you so much. I was having the same issue and your solution worked perfectly. 😉
Appreciate this snippet of code. Solved the problem!
Hello dear Sonya, i have emailed you pertaining to this issue, kindly reply
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024