Customization Group
A customization group represents a set of options that can be selected or filled by the customer when purchasing a product. These groups are used for things like extra toppings, engraving text, or additional product features, and can contain various types of options (dropdowns, checkboxes, text fields, etc.).
Usage Example
{%- comment -%} Render all customization groups and their options for a product {%- endcomment -%}
{% for group in product.customization_groups %}
<h3>{{ group.title }}</h3>
{% if group.type == 'select' %}
<select name="{{ group.id }}">
{% for option in group.options %}
<option value="{{ option.id }}">
{{ option.title }}{% if option.price > 0 %} (+{{ option.price | money }}){% endif %}
</option>
{% endfor %}
</select>
{% elsif group.type == 'checkbox' %}
<ul>
{% for option in group.options %}
<li>
<label>
<input type="checkbox" name="{{ group.id }}[]" value="{{ option.id }}">
{{ option.title }}{% if option.price > 0 %} (+{{ option.price | money }}){% endif %}
</label>
</li>
{% endfor %}
</ul>
{% else %}
<ul>
{% for option in group.options %}
<li>
{{ option.title }}{% if option.price > 0 %} (+{{ option.price | money }}){% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
Properties
id
Returns the unique id for this customization group.
title
Returns the display name of the group.
options
Returns an array of customization_group_option objects for this group.
required
Returns true if the group is required.
type
Returns the type of the group (e.g. ‘dropdown’, ‘checkbox’, ‘text’, etc.).
min
Returns the minimum number of options that must be selected (if applicable).
max
Returns the maximum number of options that can be selected (if applicable).
help_text
Returns the help text for the group, if any.