Control which selling plan groups can be attached to products?

I’m trying to use SellingPlanGroups and SellingPlans to create a digital subscription with 2 different billing intervals:
- Monthly, priced at 9.99$*
-* Annual, priced at 99.99$

I can set up the monthly price (9.99) on the Product, but the annual price is trickier: it requires me to create a SellingPlanRecurringPricingPolicyInput where the adjustmentType is PRICE, and the adjustmentValue.fixedValue is 99.99.

Having a fixed price here essentially means that this SellingPlan (or the SellingPlanGroup) should only be used for this particular product, because some other product may have a different monthly price, and also a different annual price.

And here comes the issue: the purchase options card that Shopify shows on the edit product screen allows the merchant to attach this SellingPlanGroup to any product, without the app having any control on whether this should be allowed or not.

Looking through some of the subscriptions apps it looks like the legacy extension did allow blocking this, but the new extension does not.

I can only subscribe to the selling_plan_group/update webhook to be notified when this happens, but this gives me no control.

It seems like SellingPlanGroups and SellingPlans are designed for physical “subscribe and save” type of subscriptions, and don’t fit digital memberships/courses very well.

One easy fix for this would be to allow apps to control, what exactly happens when a merchant tries to add or remove a SellingPlanGroup using the purchase options UI in the edit product page. This would allow the app to limit the SellingPlanGroup to a particular single product.

1 Like

Hey @itambek :waving_hand: - thanks for getting in touch. At the moment, this is expected behaviour:

Essentially, for purchase option extensions, Shopify controls adding a product or product variant to an existing purchase option or removing a product or product variant from an existing purchase option (more specifically allowing the merchant to do this within the admin). On the app side of things, the app is responsible for creating a purchase option on a product or product variant page/editing a purchase option from a product or product variant page if that makes sense.

That said, I definitely get where you’re coming from when it comes to the different type of subscription set up for different offerings like courses, to make it easy to swap in/out different offerings when needed (or just to add validation/protections for certain products being allowed to be added to specific groups, etc.).

Using the selling_plan_groups/update webhook to detect when products are added, then programmatically removing invalid ones via sellingPlanGroupRemoveProducts should work if needed though. It’s not the most ideal, but can you let me know if this works for you?

I’m happy to put through a feature request for you as well per your use case, just let me know and I can set that up on my end here.

Hope this helps!

Hi @Alan ! Thanks for the feedback. Listening to the selling_plan_groups/update webhook is something we considered, but it’s not ideal because the removal happens silently in the background, and there’s no feedback for the merchant - the group simply disappears the next time they load the page. This can be rather confusing and frustrating.

If we could at least notify the merchant in real-time in the app (not via email), that would be somewhat acceptable, but still not ideal.

Yes, please consider this as a feature request! Either being able to filter which SellingPlanGroups show up in the purchase options “add” list, or being able to handle what exactly happens (or prevent) adding/removing a SellingPlanGroup to/from a Product would be much appreciated :slight_smile:

Hey @itambek - no worries! Yeah, I definitely understand where you’re coming from. It’s not ideal to just silently remove the items. I did a bit more thinking on this for you, and might have another suggestion. Have you considered using Shopify’s Alert API (specifically system alerts) to give merchants immediate visual feedback when this happens?

You could theoretically display a warning banner explaining why the items were removed, etc. Here’s the doc on alerts if you want to take a look:

https://shopify.dev/docs/apps/design/user-experience/alerts

It might make the experience more clear if you wanted to go that route, so you’d have an explanation instead of just seeing things disappear on refresh. Let me know if that seems like a viable option for your setup, if not I can get that feature request set up right away for you.

We considered this as well, but I don’t think we can display immediate feedback in the edit product screen using an alert, because we only get notified of the merchant’s action via webhooks? There’s no admin frontend “event” to listen to on the purchase options extension as far as I’m aware? Meaning, any notification we can show will be asynchronous by nature, right?

If so, then no - I don’t think that’s a viable option for us.

Hey @itambek , you’re absolutely right on this one.

Since the purchase options extension doesn’t expose a frontend event for apps to listen to and alerts are triggered server-side after your app receives the webhook, there’s no way to provide that immediate synchronous feedback in the edit product screen like you’re looking for.

The merchant would only see the alert after the fact, which doesn’t totally solve the UX issue you’re describing for sure. I’ll go ahead and file that feature request for you now. Really appreciate your detailed feedback here. I’ll mark our thread as solved for now, but let me know if I can assist with anything else.