Link Search Menu Expand Document

Variant

object

Note: this defines a common interface shared between Experience Variant and Accommodation Variant.

The variant object will behave slightly differently depending on how it is accessed.

  • When accessed through an experience slot, some methods will return a result that is specific to that given slot.
  • When accessed independently or through a product, those methods will take into account all upcoming slots on the product.

Please check the method descriptions for more details.

Attributes

variant.booking_fee_rate

number

The variant’s booking fee rate as a decimal between 0 and 1.

variant.deposit

deposit

The deposit of this variant if paying with deposit is enabled, nil otherwise. If the variant has an active promotion the deposit rate should be applied to the promotional price.

Example

{% assign promotional_price = variant.price | apply_promotion: variant.promotion %}
{% assign deposit_price = promotional_price.fractional | times: variant.deposit.rate %}
{{ deposit_price | money }}

variant.deposit_amount

string

deprecated

Returns a humanized price for the variant’s deposit amount, if deposits are not set on the variant this will just return extra.price e.g. $250 Per Person.

Deprecated, the deposit should be calculated in Liquid, using a mixture of the variant.price and variant.product.deposit.rate.

{% assign deposit_price = variant.price.fractional | times: variant.product.deposit.rate %}
{{ deposit_price | money }}

variant.fees

array of fee item rates

Returns an array of fee item rates that apply to this variant.

variant.has_infinite_stock

boolean

Returns true if the variant has unlimited stock.

  • When accessed through an experience slot, it will return true if the variant has unlimited stock on the given slot.
  • When accessed independently or through a product, it will return true if the variant has unlimited stock on at least one of the upcoming product dates.

variant.humanized_display_amount

string

deprecated

A humanized price e.g. $120.00

Deprecated, the display amount should be obtained using the variant.price with the money filter.

{{ variant.price | money }}

variant.id

string

The unique id of the variant.

variant.image

image

The variant’s image if it has one.

variant.initial_stock

number

The initial stock for the variant, if the variant has unlimited inventory this will return nil.

  • When accessed through an experience slot, it will return the initial stock for the variant on the given slot.
  • When accessed independently or through a product, it will return the sum of the initial stock for the variant across all upcoming slots.

variant.is_priced_per_person

boolean

Returns true if the variant is priced per person.

variant.modifier_groups

array of modifier groups

An array modifier groups associated with this variant.

Note that the resulting list will encompass both pre- and post-checkout modifier groups, and therefore the use of this method in pre-checkout pages is not recommended.

For pre-checkout pages, pre_checkout_modifier_groups should be used instead.

variant.max_occupancy

number

The maximum number of guests for this variant.

variant.min_occupancy

number

The minimum number of guests for this variant.

variant.name

string

The variant’s name.

variant.payment_plan

payment plan

If the product this variant belongs to has a payment plan associated with it, this will return that payment plan. The payment plan won’t be returned if the last payment date is after the start date of the experience. A payment plan will still be returned if the price is less than the initial payment, so this may return a payment plan that cannot be used for this variant.

variant.pre_checkout_modifier_groups

array of modifier groups

An array of modifier groups that the customer must choose before checking out.

variant.price

price

The price of this variant in the current customer’s currency.

  • When accessed through an experience slot, it will return the price for the variant on the given slot.
  • When accessed independently or through a product, it will return the default price for the variant, managed in Experience > Variants.
{{ variant.price.fractional | money }}

This method has some deprecated behaviour. If no methods are called on the Price object that is returned from this method, then it will fallback to the legacy behaviour, which will return a string of the price, e.g. $124 Per Person. It is difficult to apply any math filters to this price string.

The behaviour of variant.price has been changed to enable math filters to be applied. It is more useful to have access to the numerical value of the price.

Deprecated method

<p>{{ variant.price }}</p>

Updated method

<p>{{ variant.price | money }} Per Person</p>

variant.prices

array of prices

An array containing the prices of each tier of this variant in the current customer’s currency.

  • When accessed through an experience slot, it will return the prices for the variant on the given slot.
  • When accessed independently or through a product, it will return the default prices for the variant, managed in Experience > Variants.

Note: this returns the first 50 prices.

{{ assign price = variant.prices | first }}
{{ price.fractional | money }}

variant.product

product

The product this variant belongs to.

variant.promotion

promotion

The variant’s current active promotion if there is one.

variant.remaining_stock

number

The remaining stock for the variant. If the variant has been manually marked as ‘Sold Out’ this will return 0. If the variant has infinite stock this will return nil.

  • When accessed through an experience slot, it will return the remaining stock for the variant on the given slot.
  • When accessed independently or through a product, it will return the sum total of remaining stock for the variant across all upcoming slots.

variant.segment_name

string

If the variant belongs to a segment this will return the segment name.

variant.sold_out

boolean

Returns true if the variant is sold out.

  • When accessed through an experience slot, it will return true if the variant is sold out on the given slot.
  • When accessed independently or through a product, it will return true if the variant is sold out across all upcoming slots. It will also return true if all slots are in the past.

variant.tagline

string

The variant’s tagline.

variant.type

string

The type of the variant, one of experience_variant or accommodation_variant. Check what other methods you can call on this drop according to their type, Experience Variant, Accommodation Variant.

variant.taxes

array of tax item rates

Returns an array of tax item rates that apply to this variant.


Table of contents