The selling_plan object
The selling_plan
object captures the intent of a selling plan applied on a line item.
selling_plan.description
Returns the selling plan's description.
selling_plan.group_id
The unique ID of the selling_plan_group that the selling plan belongs to.
selling_plan.id
The unique ID of the selling plan.
This value is used when submitting a selling_plan
to the cart.
Input
<select name="selling_plan">
{% for variant in product.variants %}
<optgroup label="{{ variant.title }}">
{% for allocation in variant.selling_plan_allocations %}
<option value="{{ allocation.selling_plan.id }}">
{{ allocation.selling_plan.name }}
</option>
{% endfor %}
</optgroup>
{% endfor %}
</select>
Output
<select name="selling_plan">
<optgroup label="Coffee">
<option value="1425">1-month subscription</option>
<option value="3642">6-month subscription</option>
<option value="3260">1-year subscription</option>
</optgroup>
<optgroup label="Tea">
<option value="1425">1-month subscription</option>
<option value="3642">6-month subscription</option>
<option value="3260">1-year subscription</option>
</optgroup>
</select>
selling_plan.name
The selling plan's name.
selling_plan.options
An array of selling_plan_option
objects that contain information about the selling plan's value for a particular selling_plan_group_option
.
selling_plan_option.name
The selling plan group option’s name.
selling_plan_option.position
The index of the the option amongst all the selling_plan_group.options
.
selling_plan_option.value
The value of the selling plan option.
This value is one of the selling_plan_group_option.values
array items.
Input
{% for option in selling_plan.options %}
{{ option.name }} : {{ option.value }}
{% endfor %}
Output
Delivery frequency : Every month
Payment frequency : Pay per delivery
selling_plan.price_adjustments
An array of selling_plan_price_adjustment
objects. A selling_plan_price_adjustment
describes how a selling plan changes the price of variants for a given period.
The maximum length of the array is 2. The array is empty when the selling plan doesn't create any price adjustments.
Each selling_plan_price_adjustment
of the selling plan maps to a selling_plan_allocation_price_adjustment
in the selling_plan_allocation
array. The selling_plan.price_adjustments
describes the intent of the selling plan, while selling_plan_allocation.price_adjustments
contains the resulting money amounts.
Input
Pay {{ selling_plan_allocation.price_adjustments[0].price | money }} on
the first {{ selling_plan.price_adjustments[0].order_count }} orders.
Output
Pay $100.00 on the first 3 orders.
price_adjustment.order_count
The number of orders that this price adjustment applies to.
The value is nil
when the price adjustment is applied either on an ongoing basis or for the rest of selling plan's duration.
price_adjustment.position
The 1-based index of the price_adjustment
in the selling_plan.price_adjustments
array.
price_adjustment.value
A float representing the value of price adjustment.
The value type of the price adjustment changes how this value is interpreted. For example, with a price_adjustment.value
of 100.00
:
- If
price_adjustment.value_type
is 'percentage', then the price adjustment is 100%. - If
price_adjustment.value_type
is 'fixed_amount' or 'price', then the price adjustment is $100.00.
price_adjustment.value_type
The type of the price adjustment.
Possible values:
percentage
: Reducing selling price by a percentage amount.fixed_amount
: Reducing selling price by a dollar amount.price
: Setting a specific selling price for the variant.
selling_plan.recurring_deliveries
Returns true
when the selling plan includes multiple recurring deliveries.
selling_plan.selected
Returns true
if the selling plan's ID is identified by the selling_plan
URL parameter.