What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Line item selling plan with Storefront API

Solved

Line item selling plan with Storefront API

brian-at-hoa
Visitor
2 0 0

Hi.

The documentation for the cart Ajax API documents how to add a line item with a selling plan. I'm not seeing a way to set a selling plan when using the Storefront API. For example, the checkoutLineItemsAdd mutation doesn't include a sellingPlan field. The roadmap (https://shopify.dev/apps/subscriptions#product-roadmap) says that the "Storefront API" feature was launched in July 2021.

How can I add a selling plan to a line item using the Storefront API?

Thanks you.

Accepted Solution (1)

LarryReid
Shopify Staff
87 9 22

This is an accepted solution.

Thanks for the question. The cartCreateMutation should let you build a cart with a subscription line item. The cartLinesAdd and cartLinesUpdate may also be what you're looking for. If those links aren't what you're looking for, let me know. Good luck!

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 8 (8)

LarryReid
Shopify Staff
87 9 22

This is an accepted solution.

Thanks for the question. The cartCreateMutation should let you build a cart with a subscription line item. The cartLinesAdd and cartLinesUpdate may also be what you're looking for. If those links aren't what you're looking for, let me know. Good luck!

To learn more visit the Shopify Help Center or the Community Blog.

brian-at-hoa
Visitor
2 0 0

Thank you, that's perfect!

Fuz-Tech
Shopify Partner
4 0 3

Hi, so the cartLinesAdd and cartCreate mutation does allow for adding a line item with selling plan, but then the only way to checkout is via a web URL. Is there any way to utilize the cartCreate and then get the checkout ID and checkout using the completeCheckout mutations?

isoftoo
Shopify Partner
2 0 1

hi , I want to use it in chekout. Is there this method

LarryReid
Shopify Staff
87 9 22

Could you please describe in a bit more detail exactly what you want to do?

To learn more visit the Shopify Help Center or the Community Blog.

isoftoo
Shopify Partner
2 0 1

我们使用 storefront mobile-buy-sdk-android 想在结账的时候 可以购买 订阅商品和 到店自取

We use storefront mobile buy SDK Android. We want to buy subscription goods and pick them up at the store when we check out


RaphHappysoft
Shopify Partner
2 0 4

This is not a valid solution...

We are using storefront in our iOS and Android apps and it forces us to use the checkoutURL of the cart object so customer go the checkout webview. BUT there is not any single simple way to get the checkout ID AND the key to query the checkout at each url loading in order to see if the customer has ended the process and an order has been created...
The only solution I found is to parse the following url that we get after the checkoutUrl of the cart in order to get the checkout id at the end of the url AND to parse the html to get a metadata to find the key... It's crazy 🤣

Why can't we have a checkoutUrl that's the same as the webUrl of the checkout and to get the ID in a simpliest way ? Or just to be able to add selling plan when we create a checkout with the lineItem of the Cart...

duckhead
Shopify Partner
1 0 4

This seems like a very common use case - we require this as well.  We can't create a checkout object since it doesn't support subscriptions/selling plan ids.  So we have to use a cart object then redirect to the web checkout url which cannot be customized (and it seems setting the buyer identity in the cart has zero impact on the checkout).

 

So, either give us the ability to create checkout objects with selling plans, or give us an easy way to create a checkout object off of the web url.  I admire RaphHappysoft ingenuity, but I fear parsing the checkout url will break when Shopify decides to willy-nilly change their url formats.