Ecommerce for Statamic

Item options

Loops through product modifiers. Outputs a <select> by default.

Parameters

url
The url of the product.
select
Whether or not to output a <select>. Defaults to yes.
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"

Variables

value
Identifier of the option (when using basic modifiers)
sku
Identifier of the option (when using the product options fieldtype)
label
The option name. When using the product options fieldtype, this will be an array of the option names. Use a variable modifier (like label|spaced_list) to output it in a readable format.
modifier
Price of the modifier
item_price
Calculated price of the item. (modifier + base price)
stock
When using the product options fieldtype, this outputs the stock level.

Example

{{ bison:add_to_cart_form }}
  <input type="number" name="quantity" />
  {{ if options }}
    {{ bison:item_options product="{url}" }}
      <option value="{{ value }}">{{ label }} / Price: ${{ item_price }}</option>
    {{ /bison:item_options }}
  {{ endif }}
{{ /bison:add_to_cart_form }}


Problem with this page? Edit it on Github.