Basket

The basket object has the following attributes:

Shopping basket totals

basket.sub_total

Returns the total of all of the individual products in the basket.

If discounts are applied to the basket these will be included in this value.

The account's B2B settings will determine whether the variable is returned including or excluding VAT.


basket.original_sub_total

Returns the original sub total of all the individual products in the basket (before any discounts are applied).

The account's B2B settings will determine whether the variable is returned including or excluding VAT.

Additional price variables are available to display the total regardless of those settings.

basket.original_sub_total_excluding_tax
basket.original_sub_total_including_tax


basket.discount

Returns the total value of any discounts applied to the basket (such as voucher codes).


basket.vat

Returns the amount of VAT in the order.


basket.shipping

Returns the total cost of shipping.

If discounts are applied to the shipping total these will be included in this value.

The account's B2B settings will determine whether the variable is returned including or excluding VAT.


basket.original_shipping

Returns the total cost of shipping (before any discounts are applied).

The account's B2B settings will determine whether the variable is returned including or excluding VAT.

Additional price variables are available to display the total regardless of those settings.

basket.original_shipping_excluding_tax
basket.original_shipping_including_tax


basket.total

Returns the total amount of the order.


basket.partial_payment_total

Returns the total of any partial payments applied to the order (such as gift cards and when reward points are redeemed).


Including and excluding tax

The account's B2B settings will determine whether subtotal and shipping variables are returned displaying the price including or excluding vat.

Additional price variables are available to display the price regardless of those settings.

basket.shipping_including_tax

basket.shipping_excluding_tax

basket.sub_total_including_tax

basket.sub_total_excluding_tax


Shipping countries and states

basket.shipping_countries

Returns an array of the available shipping zones.

state.id

Returns the ID of the state.


state.current

Returns true if the state is the current state.


state.name

Returns the name of the state.


country.id

Returns the ID of the country.


country.name

Returns the name of the country.


Reward points

basket.reward_points_earned

Returns the total number of reward points earned with the purchase.


basket.has_redeemed_points

Returns true if the visitors reward points have been redeemed for a cash discount.


basket.reward_points_discount

Returns the discount obtained from redemption of reward points (but only once they have been redeemed).


basket.reward_points_converted

Returns the number of reward points redeemed for a cash discount.


basket.reward_points

Returns the number of reward points in the customer's account (will update to the remaining balance once reward points have been redeemed).


basket.can_redeem_points

Returns true if the customer has sufficient reward points to be redeemed.


Voucher codes

basket.voucher_codes

Returns an array of voucher codes used on the basket.

basket.voucher_codes.code

Returns the voucher code used on the basket, as part of the array.

To return the voucher code you can use basket.voucher_codes[0].code