For discussing the development and integration of subscription-enabled shops using Shopify's Subscription APIs.
When building a SellingPlanGroup, you can add products or variants to the group.
Currently the only way to get to SellingPlanGroup in liquid is through product.selling_plan_groups which includes all selling plan groups on any of the product's variants. Is there a way to display selling plan groups by variant?
For context, we are trying to determine the best way to offer a 3-pack variant and a 4-pack variant, each with its own selling plan based on the variant.
Thanks!
Heya
Have you tried using `variant.selling_plan_allocations`?
https://shopify.dev/docs/themes/liquid/reference/objects/variant#variant-selling_plan_allocations
A selling plan allocation will give you the information needed when a selling plan is applied on a variant: https://shopify.dev/docs/themes/liquid/reference/objects/selling-plan-allocation
To learn more visit the Shopify Help Center or the Community Blog.
Hi Philibert,
Thanks for the quick response. I have looked at that and will keep plugging away at it.
We might be trying to use this for something it was intended for. We are trying to offer subscriptions based on two different variants not based on a difference in frequency, etc. Most of the examples are coffee delivery frequency: weekly, every other week, etc and the frequency has no bearing on the variant since the variant is the same.
In our case, we'd like to use a variant so we have inventory management, etc.
The 3-pack variant has one price every 3 months and the 4-pack variant has a different price every 3 months.
After a few hours of considering each option, for our use-case it looks like the easiest way for us to do this will be to split the 4-pack and 3-pack into their own products (with their own variants) and give them each their own SellingPlanGroup.
SellingPlanAllocation is useful but doesn't get us what we need to filter the list of selling plan groups based on variant.
Thanks again!