Modifier

A selectable modifier within a variant.

A selectable modifier within a variant. Access via variant.modifiers.

Behaviour varies by context:

  • When accessed through an ExperienceSlotDop, 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.

Properties

availability_status

A high-level availability signal for this modifier, so themes can show "limited"/"running low" states without deriving them from the raw remaining count. Prefers the stock manager's own status (letting an external provider's signal come through) and falls back to the percentage-based rule when it doesn't have one.

Returns: String — one of "available", "limited", or "sold_out".

See also: StockManagement::AvailabilityStatus

checkbox_attributes

HTML attributes for a checkbox input for this modifier.

Returns: String — includes checked when selected and disabled when sold out or not already selected.

<input {{ modifier.checkbox_attributes }}>

contents

Content library biographies linked to this modifier.

Returns: Array (ContentDrop)

custom_fields

Custom field key-value pairs defined on this modifier.

Returns: Array (Hash{String=>String}) — each hash has "key" and "value" string entries.

{% for field in modifier.custom_fields %}
  {{ field.key }}: {{ field.value }}
{% endfor %}

custom_fields_data

Custom field values keyed by field name.

Returns: Hash{String=>String}

{{ modifier.custom_fields_data.category }}

data_attributes

HTML data attributes for this modifier, including id, name, and optional start and end times.

Returns: String

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

end_at

When this modifier stops being available.

Returns: Time or nil

filter_attributes

HTML data attributes for filterable custom fields, plus data-filterable which marks the element for the post-checkout selections filter controller.

Only custom fields marked as filterable in the admin are included. Field names are parameterised in attribute names (e.g. "Difficulty rating" becomes data-difficulty-rating="hard"). Use on post-checkout selection pages so customers can filter modifiers by custom field values in JavaScript.

Returns: String — always includes data-filterable; each filterable field adds a data-<field-name>="<value>" attribute.

<p {{ modifier.filter_attributes }}>{{ modifier.name }}</p>

has_infinite_stock

Whether this modifier has unlimited stock.

Returns: Boolean

id

The modifier unique identifier, a UUID.

Returns: String

image

The modifier's image when one is attached.

Returns: ImageDrop or nil

initial_stock

Initial stock for this modifier.

Returns: Integer or nil — nil when any underlying mapping has infinite stock.

label_attributes

HTML attributes for a label element targeting this modifier's checkbox.

Returns: String

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

limited

Whether stock is running low but not yet sold out. Convenience predicate over #availability_status.

Returns: Boolean

name

The modifier name.

Returns: String

price

The modifier price in the subunit of the current currency.

When accessed through an ExperienceSlotDrop, returns the price for that slot. When accessed through a product or independently, returns the default price from Experience > Modifiers in the admin.

Returns: Integer or nil — nil when there is no current currency; e.g. 1950 for $19.50.

{{ modifier.price | money }}

remaining_stock

Remaining stock for this modifier.

When accessed through an ExperienceSlotDrop, returns remaining stock for that slot. When accessed through a product or independently, returns the sum across all upcoming slots. For accommodations, returns inventory remaining stock on the modifier itself. Returns 0 when the modifier has been manually marked as sold out.

Returns: Integer or nil — nil when any underlying mapping has infinite stock.

selected

Whether this modifier is currently selected by the customer.

Used on post-checkout selection pages to pre-check modifiers the customer has already chosen.

Returns: Boolean

sold_out

Whether this modifier is sold out for customers.

Returns: Boolean — true across all upcoming slots when not scoped to a slot mapping, or when there are no upcoming slots.

start_at

When this modifier becomes available.

Returns: Time or nil

tagline

A short description of the modifier.

Returns: String or nil

On this page