Skip to Content

Product Option

The product_option object describes a selectable option for a product, such as size or color. It provides access to the option’s handle, title, sort order, taxonomy attribute, and the available values for the option. It also supports combined listings and selection logic.

Usage Example

{%- comment -%} Render a dropdown for a product option {%- endcomment -%} <label>{{ product_option.title }}: <select name="option_{{ product_option.handle }}"> {% for value in product_option.values %} <option value="{{ value.handle }}" {% if product_option.selected_value and product_option.selected_value.handle == value.handle %}selected{% endif %}>{{ value.label }}</option> {% endfor %} </select> </label>

Properties

handle

Returns the handle of the option.

title

Returns the title (name) of the option.

is_for_combined_listing

Returns whether this option is for a combined listing.

sort_order

Returns the sort order of the option.

taxonomy_attribute_id

Returns the taxonomy attribute ID for this option.

taxonomy_attribute_handle

Returns the taxonomy attribute handle for this option.

taxonomy_attribute

Returns the related taxonomy attribute for this option.

values

Returns the values for this option. The values are dynamically determined based on the product’s variants and selection logic, and may include values from combined listings.

selected_value

Returns the selected value for this option, or null if none is selected.

Last updated on