Adding subscription products to cart

Topic summary

A developer is building a Shopify app with subscription functionality and has completed the backend for creating subscriptions and displaying options via a theme extension on product pages.

Current Challenge:

  • Uncertain about the best method to add products with subscription plans to the cart
  • Questioning whether cartCreate mutation (using lines.merchandiseId and sellingPlanId) is appropriate
  • Needs to understand how to handle/replace the checkout URL to align with the store’s default checkout flow

Suggested Solution:
Use the Cart REST API instead of cartCreate when working within the theme context. The cartCreate mutation is recommended primarily for custom storefronts, not theme-based implementations.

Status: The discussion remains open with one technical recommendation provided, but no confirmation yet on whether this resolves all aspects of the developer’s implementation questions.

Summarized with AI on October 23. AI used: claude-sonnet-4-5-20250929.

Hi Team,
We are developing a new app with subscription functionality and have run into an issue.
So far, we have completed the backend functionality for creating subscriptions and are displaying the subscription options on the PDP page through a theme extension. The next step is where we’re stuck.

  • What is the recommended way to add products with subscription plans to the cart?

  • Can this be achieved directly using the cartCreate mutation (with lines.merchandiseId and sellingPlanId)?

  • If we use cartCreate, how do we properly handle or replace the generated checkout URL so it aligns with the store’s default checkout flow?

Any guidance or examples on the correct approach would be greatly appreciated.

If working from within the theme, rather use Cart REST API – https://shopify.dev/docs/api/ajax/reference/cart#add-a-selling-plan

cartCreate is IMO for custom storefronts