The selling_plan_group object

A group of selling plans available for some or all of a product's variants. Selling plans in a group all share the same selling_plan_option.name values.

Input

{% for selling_plan_group in product.selling_plan_groups %}
 {{ selling_plan_group.name }} :

 {% for selling_plan in selling_plan_group.selling_plans %}
   - {{ selling_plan.name }}
 {% endfor %}
{% endfor %}

Output

Subscribe & save:
 - Weekly (save 10%)
 - Monthly (save 5%)

Prepaid subscriptions:
 - Prepaid for 1 year

selling_plan_group.id

A unique ID for the selling plan group.

selling_plan_group.name

The name of the selling plan group.

selling_plan_group.options

An array of selling_plan_group_option objects. A selling_plan_group_option object contains the name and respective values of an individual item in the selling_plan_group.options array.

Input

{% for option in selling_plan_group.options %}
  <label>{{ option.name }}</label>
  <select>
    {% for value in option.values %}
    <option {% if value == option.selected_value %}selected{% endif %}>
      {{ value }}
    </option>
    {% endfor %}
  </select>
{% endfor %}

Output

<label>Delivery frequency</label>
<select>
  <option>Every week (save 10%)</option>
  <option selected>Every month (save 5%)</option>
  <option>Every 2 months (save 5%)</option>
</select>

selling_plan_group_option.name

Returns the selling plan option’s name.

selling_plan_group_option.position

Returns the index of the the option amongst all the selling_plan_group.options.

selling_plan_group_option.selected_value

Returns the value for the selling plan group option when a selling plan allocation is selected. The selected selling plan allocation is based on both the URL parameters selling_plan and id.

selling_plan_group_option.values

An array of values for the selling plan group option.

selling_plan_group.selling_plan_selected

Returns true if the selected selling plan is part of the selling plan group. The selected selling plan is based on the URL parameter selling_plan.

selling_plan_group.selling_plans

An array of selling_plan objects that belong to the selling_plan_group.

selling_plan_group.app_id

An optional string provided by an app to identify selling plan groups created by that app.

If no string is provided by the app, then this property returns nil.

For example, if an app creates selling plan groups with an app_id of "yourApp", then you can use the where filter to create an array of only those selling plan groups.

Input

{% assign filtered_groups = product.selling_plan_groups | where: "app_id", "yourApp" %}
Total selling plan groups: {{ product.selling_plan_groups.size }}
Filtered selling plan groups: {{ filtered_groups.size }}

Output

Total selling plan groups: 3
Filtered selling plan groups: 1