Ecommerce for Statamic

Add to cart form

Outputs a form for adding an item to your cart. Typically on your product detail page.

A typical form might look like this:

{{ bison:add_to_cart_form }}
  <input type="number" name="quantity" />
  <input type="submit" />
{{ /bison:add_to_cart_form }}

Parameters

product
If you aren’t displaying a form on an entry page, this will tell Bison which product to add.
return
The URL you’d like to redirect to once the form is submitted. By default, it’ll return to the same page.
error_return
The URL to be shown if there is a problem adding the item.
attr
Allows you to set any number of HTML attributes on the <form> tag. Attribute and value should be separated by a colon : and you can specify multiple attributes by pipe | delimiting them.
eg. attr="class:my-form|data-this:that"
allow_user_price
Set this to yes to allows the user to specify the price of the product. Useful for donations. This makes the price field available.
extra
Extra data to make the cart item unique. Pipe delimited, colon separated values, eg. size:small|color:red

Fields

  • quantity
  • item_option
  • price (only if allow_user_price is set to yes)


Problem with this page? Edit it on Github.