Basket items
The basket.items array returns the line items within a visitor's shopping basket.
The basket.items array will return the following attributes when used within {% for item in basket.items %}:
item.id
Returns the unique platform ID of the item in the customer's basket and any variation/options selected.
item.product
Returns the product object.
item.quantity
Returns the quantity of the individual product added to the basket.
item.price
Returns the price the customer will pay for the item. This price will include any discounts applied to the customer's order (like voucher codes). For the original price of the item (before discounts are applied) please refer to the 'original_price' variables listed below.
Including and excluding tax
The account's B2B settings will determine whether the item.price variable is returned displaying the price including or excluding VAT.
Additional price variables are available to display the price regardless of those settings.
item.price_including_tax
item.price_excluding_tax
item.original_price
Returns the original price of the item. Like the item.price variable, the account's B2B settings determine whether this price is returned including or excluding VAT. Additional variables are available to display the price regardless of the setting.
item.original_price_excluding_tax
item.original_price_including_tax
item.total
Returns the item.quantity x item.price.
item.remove_url
Returns the URL the visitor needs to visit in order to remove the item from their basket. Visiting the URL will return the customer to the current page.
item.comments
Returns any comments attached to the item in the basket when the item was added to the basket (when the product form was submitted).
item.is_gift_voucher
Returns whether the item in the basket is a gift voucher.
item.options
Returns an array of the options (variations) chosen when the item was added to the basket.
{% for name, value in item.options %} {{ name }}: {{ value }} {% endfor %}
returns...
Size: Small
{{ name }} returns the name of the variation type (e.g. 'Size').
{{ value }} returns the option chosen (e.g. 'Small').
variation_id
Returns the ID of the variation combination selected when the item was added to the basket.
item.choices
Returns an array of the product choices chosen when the item was added to the basket.
{% for choice in item.choices %} {{ choice.name }} ~ {{ choice.value }} ~ {{ currency_value(choice.price) }} {% endfor %}
returns...
Size ~ Small ~ £10.00
{{ choice.name }} returns the name of the product choice type (e.g. 'Size').
{{ choice.value }} returns the option chosen (e.g. 'Small').
{{ choice.price }} returns the additional cost of the option chosen (e.g. '10.00').
item.extras
Returns an array of the product extras chosen when the item was added to the basket.
{% for extra in item.extras %} {{ extra.name }}: {{ currency_value(extra.price) }} {% endfor %}
returns...
Mobile phone charger: £25.00
{{ extra.name }} returns the name of the extra chosen.
{{ extra.price }} returns the price of the extra chosen.
item.weight
Returns the weight of the item in the basket (it is not affected by quantity).
item.gift_voucher.sender
Returns the value entered as the sender of the gift voucher.
item.gift_voucher.recipient
Returns the value entered as the recipient of the gift voucher.
item.gift_voucher.message
Returns the value entered as the gift voucher message.
item.variation
Returns an object with variables containing details about the basket item variation selected.
{{ item.variation.values }} returns the values of the variation combination e.g. Small Green Metal
{{ item.variation.image_url }} returns the URL of the image assigned to the variation combination
{{ item.variation.sale_price }} if the product has a sale price, this will return the product sale price (if a % sale is set this will return the sale price of the variation combination)
{{ item.variation.price }} returns the price of the variation combination
{{ item.variation.gtin }} returns the GTIN set for the variation combination
{{ item.variation.mpn }} returns the MPN set for the variation combination
{{ item.variation.sku }} returns the SKU code of the variation combination
{{ item.variation.in_stock }} returns true or false depending on whether the variation combination is in or out of stock
{{ item.variation.quantity }} returns the stock quantity of the variation combination
{{ item.variation.id }} returns the ID of the variation combination