Link Search Menu Expand Document

Modifier

object

The modifier 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

modifier.id

string

The unique ID for the modifier.

modifier.checkbox_attributes

html

A string of HTML attributes to be used on a checkbox for the modifier.

  • The checked attribute is included if this modifier has been selected by the customer. Currently used on the selections page.
  • The disabled attribute is included if the modifier is sold out and not already selected.
<input {{ modifier.checkbox_attributes }}>

modifier.contents

array of biographies

An array of biographies that are associated with the modifier.

modifier.custom_fields

array of key-value pairs

An array of custom properties defined on this modifier. Each custom field has two methods: key and value.

<ul>
  {% for field in modifier.custom_fields %}
    <li>{{ field.key }}: {{ field.value }}</li>
  {% endfor %}
</ul>

modifier.custom_fields_data

object

An object containing the custom properties for the modifier.

{{ modifier.custom_fields_data.category }}

modifier.data_attributes

html

A string of HTML data attributes for the modifier, including id, name and if present, start-at and end-at. e.g.

[
  "data-modifier-id='076f47e9-7061-4c01-90a5-a36b1970ffe3'",
  "data-modifier-name='Parking'",
  "data-modifier-start-at='2023-04-25 00:00'",
  "data-modifier-end-at='2023-05-06 00:00'"
]

It can be used in the Liquid markup like this:

<input {{ modifier.checkbox_attributes }} {{ modifier.data_attributes }}>

modifier.end_at

timestamp

The end time for this modifier.

{% modifier.end_at | date: "%d-%m-%Y %k:%M" %}

modifier.filter_attributes

html

A string of HTML data attributes representing the custom field key-value pairs that have been specified as filterable.

For example, a modifier with filterable custom fields and values “Category” and “Yoga”, and “Difficulty” and “Hard” would end up with data attributes data-category="Yoga" and data-difficulty="Hard".

The first attribute, data-filter-target="filterable" identifies the element to the filter controller and is always present.

This is useful for handling the filtering of modifiers via Javascript.

modifier.has_infinite_stock

boolean

Returns true if the modifier has unlimited stock.

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

modifier.image

Image

The modifier’s image.

modifier.initial_stock

number

The initial stock for the modifier. If the modifier has unlimited inventory this will return nil.

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

modifier.label_attributes

html

A string of HTML attributes to be used on an input label for the modifier.

<label {{ modifier.label_attributes }}>{{ modifier.name }}</label>

modifier.name

string

The name of the modifier.

modifier.price

number

The price of the modifier as a fractional in the sub-unit of the current customer’s currency. e.g. considering the amount $19.50, it will return 1950.

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

modifier.remaining_stock

number

The remaining stock for the modifier. If the modifier has been manually marked as ‘Sold Out, this will return 0. If the modifier has unlimited inventory this will return nil.

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

modifier.selected

boolean

Returns true if this modifier has been selected by the customer. Currently used on the selections page.

modifier.sold_out

boolean

Returns true if the modifier is sold out.

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

modifier.start_at

timestamp

The start time for this modifier.

{% modifier.start_at | date: "%d-%m-%Y %k:%M" %}

modifier.tagline

string

The tagline of the modifier.