Adding subscription plan in order create mutation

Hi Team,
We are trying to create an order using GraphQL mutations in Shopify. However, we’re facing an issue where we’re unable to include the sellingPlanId in the orderCreate mutation, although it can be added successfully in the cartCreate mutation. Could anyone suggest how to associate a sellingPlanId when using the orderCreate mutation?

You can’t add a subscription plan directly in the orderCreate mutation. Instead, you need to create a subscription contract first, then trigger a billing attempt to generate the order.

Thanks for your reply. We have already created the subscription contract. Is the order automatically created once the subscriptionBillingAttemptCreate mutation query is executed?. Or do we need to execute any additional mutations?

Hi,

Hope this will help. As you have already created a subscription contract

  • DO use Cart API (cartCreate, cartLinesAdd, checkoutUrl).
  • DON’T try to use orderCreate directly for subscriptions — it’s not built for that.