Adding a quantity field to your product pages

From Spiffy Stores Knowledge Base

Jump to: navigation, search

To add a quantity field, you just need to include a field with the name & ID of "quantity" in your add to cart form. The cart should then pick up the quantity variable.

To do this, you go to your Theme Editor, which can be found in the "Design & assets -> Theme editor" section of your store's Toolbox. Edit the product.liquid file, and look for the cart submit button. The code for this button should look something like this...

<input id="submit" class="button" type="submit" name="add-to-cart-button" alt="Buy this product"/>

Paste the following code before the submit button, and then save your file.

<label for "quantity">Quantity</label>
<input id="quantity" name="quantity" type="text" value="1" size="4">

Your code should then look something like this...

<label for "quantity">Quantity</label>
<input id="quantity" name="quantity" type="text" value="1" size="4">
<input id="submit" class="button" type="submit" name="add-to-cart-button" alt="Buy this product"/>

If you preview a product page, you should now be able to see the quantity field. You may need to style the field and text using CSS to get it to match the styles in your theme.