less than a minute read • Updated 10 minutes ago
Create a product form
How to create an add to cart form to sell a product with customer-configurable options.
An add-to-cart form works like a product link but allows customers to configure options before adding to the cart — such as selecting a size, colour, or quantity. Use a form when your product has options that customers need to choose from.
How to set it up
A basic add-to-cart form looks like this:
<form action="https://YOURSUBDOMAIN.foxycart.com/cart" method="post">
<input type="hidden" name="name" value="Product Name" />
<input type="hidden" name="price" value="9.99" />
<input type="submit" value="Add to cart" />
</form>
Replace YOURSUBDOMAIN with your store’s subdomain, and set name and price to match your product.
Adding customer-configurable options
Use select, radio, or checkbox inputs to let customers choose options:
<form action="https://YOURSUBDOMAIN.foxycart.com/cart" method="post">
<input type="hidden" name="name" value="T-Shirt" />
<input type="hidden" name="price" value="19.99" />
<select name="size">
<option value="small">Small</option>
<option value="medium">Medium</option>
<option value="large">Large</option>
</select>
<input type="submit" value="Add to cart" />
</form>
For a full list of available parameters see Standard parameters reference.
Notes
For simple products with no configurable options, a link is easier — see Create a product link.
If you need to secure your forms against tampering, see HMAC product verification in the Foxy documentation.
Sample add-to-cart code is available in the Sample Code section of your Foxy admin.
Product parameters are case sensitive.