Selling Plan object not detected on storefront

Hello ,

I am new to shopify subscription app creation and following shopify tutorial : https://shopify.dev/tutorials/create-manage-selling-plans

I manage to successfully create selling plan for my development store and added product to selling plan.

Here is the screen shot : https://nimb.ws/YA84eQ

Now i am trying to fetch the selling_plan in storefront with below code

{% for group in product.selling_plan_groups %}

{{ group.name}}

{% for selling_plan in group.selling_plans %}

{{ selling_plan.name }}

{% endfor %}

{% endfor %}

But i am was unable to get anything .

So for debugging i tried following code

{{product.selling_plan_groups |size}}

output:

0

So actually , i am new to this and unable to find solution how to access selling_plan on storefront.

i also other shopify articles and this one https://shopify.dev/tutorials/customize-theme-showing-selling-plan-groups-and-selling-plans

Can anyone with subscription app experience help me ?

Hi @Test1231

Hope you’re having a great day!

What gateway do you use? (for testing)

As specified here, to use subscriptions, you must be using one of the following gateways as your payment gateway: Shopify Payments and PayPal Express.

So for debugging i tried following code

For array, the syntax is:

{{ my_array.size }}

So try this:

{{ product.selling_plan_groups | size }}

If you have any further questions, please do reach out either here on the forum, or via a private message/email.

2 Likes

Hi , @Morek

Thank you for your reply ,

I will make sure to like and accept solution once i get some results.

I am already using Paypal Express Checkout .

And still this snippet {{ product.selling_plan_groups | size }} output 0 . see screen shot

snippet : https://nimb.ws/hNeajq

output: https://nimb.ws/oOqaMh

selling plan for this product : https://nimb.ws/tkipQb

Can you help me because i am unable to detect what is the problem ?

Hi @Test1231

Hope you’re having a great day!

Try this:

{{ product.selling_plan_groups.size }}

and tell me what you get for value.

If you have any further questions, please do reach out either here on the forum, or via a private message/email.

1 Like

Hi , @Michal_Morek

Thank you for your reply ,

I will make sure to like and accept solution once i get some results.

I already tried this and still have same result.

But i have one question,

do we need to set business account in PayPal Express to render selling plan?

Hi @Test1231

do we need to set business account in PayPal Express to render selling plan?

Yes! As specified by Shopify:

To use PayPal on your store, you should upgrade your personal account to a business account. Most functions and tools provided by PayPal for business owners are only available when using a business account.

The most important thing is we find a solution. I will test the code on my side and find a solution for you.

If you have any further questions, please do reach out either here on the forum, or via a private message/email.

1 Like

Thank you for your reply ,

we will try with business account.