Solved

Scripts Editor App: Test Subscription Products

pcosta99
Shopify Partner
5 1 2

Hi everyone,

I am trying to create a script to manage subscription line items in the cart. 
I wanted to test things out while using the Script Editor app preview (clicking "Run Script").

I have two doubts.

1) How can I add a product as a subscription to the cart? There is no option to select between plans.

(PS: If there's a way around 1), my original issue might be solved) 

2) I created a product that can only be sold as a subscription. When I try to add it to the cart, I get the following error:

pcosta99_0-1659546746310.png


How can I test things out for subscriptions in the Script Editor App?
Any insight is highly appreciated.

Thank you very much,
Pedro Costa.

Accepted Solution (1)
pcosta99
Shopify Partner
5 1 2

This is an accepted solution.

Hi, sorry for the late reply, just noticed the activity!

The issue is really with the editor on the Shopify Scripts app, there is no option to select a selling plan ID there (when adding to the cart input section).
When previewing on the shop, it does work as intended when I select a product with a selling plan associated.

Thanks for the response, for the time being my workaround is just testing stuff with regular one-offs on the Script Editor app and then invert the condition to check if a variant is a subscription or not.

View solution in original post

Replies 4 (4)

SealSubs
Explorer
79 1 4

Hi,

This error means that you have to include the selling_plan parameter when adding the product to the cart 😉 I am not sure how you are adding products to the cart in your case, but basically, you jut have to include the selling_plan parameter (which contains selling plan id) on the same level as the id parameter (which contains variant id).

Seal Subscriptions App, a subscription app for Shopify, with glowing user testimonials.
pcosta99
Shopify Partner
5 1 2

This is an accepted solution.

Hi, sorry for the late reply, just noticed the activity!

The issue is really with the editor on the Shopify Scripts app, there is no option to select a selling plan ID there (when adding to the cart input section).
When previewing on the shop, it does work as intended when I select a product with a selling plan associated.

Thanks for the response, for the time being my workaround is just testing stuff with regular one-offs on the Script Editor app and then invert the condition to check if a variant is a subscription or not.

SealSubs
Explorer
79 1 4

Thanks for sharing this with the community 🙂 And good job for finding the workaround!

Seal Subscriptions App, a subscription app for Shopify, with glowing user testimonials.
pcosta99
Shopify Partner
5 1 2

Although it is a bit manual, it does work, thanks! 😀