Difference between revisions of "Adding a quantity field to your product pages"

From Spiffy Stores Knowledge Base

m
 
Line 18: Line 18:
 
<pre>
 
<pre>
 
<label for "quantity">Quantity</label>
 
<label for "quantity">Quantity</label>
<input id="quantity" type="text" value="1" size="4">
+
<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"/>
 
<input id="submit" class="button" type="submit" name="add-to-cart-button" alt="Buy this product"/>
 
</pre>
 
</pre>
  
 
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.
 
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.

Latest revision as of 16:00, 18 April 2013

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.