1 product in stock, but cart page allows user to update quantity to add more than what's in stock.

Highlighted
Shopify Partner
40 0 4

How do I fix this?

Most of my products are 1 of a kind, so typically there is only 1 in stock of each product. When the user gets to the cart, each line item has a Quantity section that allows the user to add more than the amount of items in stock. 

How do I completely remove the quantity text field or only allow it to be changed up to the amount in stock?

Thank you!

0 Likes
Highlighted
Shopify Staff
Shopify Staff
5704 1 319

Hello there!

or only allow it to be changed up to the amount in stock?

You can try the following for this: http://docs.shopify.com/manual/configuration/store-customization/page-specific/cart-page/how-do-i-li...

Let us know how that goes!

1 Like
Highlighted
Shopify Partner
40 0 4

My site is using ajaxify cart, so I think my cart uses ajax-cart-template.liquid (it's from the Timber starter theme: http://shopify.github.io/Timber/).

Any way to make this work with that theme? Or else disable those little + and - signs around the quantity box?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
5704 1 319

You can init the Ajax module: http://shopify.github.io/Timber/#ajax-cart with those quantity + / - disabled:

enableQtySelectors: false,

 

0 Likes
Highlighted

This works but I had to add the following to the cart.liquid file to keep products being added to the cart that were over the inventory amounts:

 

{% if item.quantity > item.variant.inventory_quantity %}<input type="number" name="updates[]" id="updates_{{ item.key }}" data-id="{{ item.key }}" value="{{ item.variant.inventory_quantity }}" {% unless item.variant.inventory_management == blank or item.variant.inventory_policy == 'continue' %} max="{{ item.variant.inventory_quantity }}" {% endunless %} min="0" data-line="{{ forloop.index }}">

{% else %}

<input type="number" name="updates[]" id="updates_{{ item.key }}" data-id="{{ item.key }}" value="{{ item.quantity }}" {% unless item.variant.inventory_management == blank or item.variant.inventory_policy == 'continue' %} max="{{ item.variant.inventory_quantity }}" {% endunless %} min="0" data-line="{{ forloop.index }}">

{% endif %}

 

The above replaces:

<input type="number" name="updates[]" id="updates_{{ item.key }}" data-id="{{ item.key }}" value="{{ item.quantity }}" min="0" data-line="{{ forloop.index }}">

 

Probably a better way of doing it, but I'm self-taught

1 Like