Update cart form
Outputs a form for updating the contents of your cart. You can update the quantities of multiple items at once or remove them.
Parameters
return
- The URL you’d like to redirect to once the form is submitted. By default, it’ll return to the same page.
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
title
- The title of your product’s entry.
url
- URL of the product’s entry.
quantity
- How many have been added to the cart.
price
- Price of the item with any price modifiers applied.
subtotal
- The line total. (price x quantity)
entry
- This gives you access to any of the product entry’s fields. You could access a field named
sku
by usingentry.sku
item_option
- If the product in the cart has a product modifier applied, this will return the name of it.
item_option_modifier
- If the product in the cart has a product modifier applied, this will return the price modifier dollar value.
product_price
- This will return the base price of the product.
count
- The iteration of the product in the cart.
index
- Same as
count
. zero_index
- The zero-based index/count.
first
- Returns true if it is the first item.
last
- Returns true if it is the last item.
total_results
- Total items in the cart.
Fields
The fields you use will need to have the item row index inside the brackets of the field name.
quantity[item_index]
remove[item_index]
Example
{{ bison:update_cart_form }}
{{ if first }}
<table>
<tr>
<td>Product</td>
<td>Quantity</td>
<td>Subtotal</td>
<td>Remove</td>
{{ endif }}
<tr>
<td>{{ title }}</td>
<td><input type="number" name="quantity[{{ zero_index }}]" value="{{ quantity }}" /></td>
<td>{{ subtotal }}</td>
<td><input type="checkbox" name="remove[{{ zero_index }}]" value="yes" /> Remove?</td>
</tr>
{{ if last }}
</table>
<input type="submit" value="Update" />
{{ endif }}
{{ /bison:update_cart_form }}
Problem with this page? Edit it on Github.