Combine the content of multiple contracts
When a customer has multiple subscription contracts with the same merchant, you might want to combine the content of their contracts together when their billing cycles align. When you combine the content of multiple contracts together, Shopify creates only one order to handle each contract's respective billing cycles, and combines the pricing and line information. This can be useful to save on shipping, billing, and other administrative costs.
For example, a customer might have one subscription that bills and delivers weekly, and one subscription that bills and delivers monthly. When the billing and delivery for both subscriptions occur within the same week, the merchant might want to combine the subscription orders for that week so they can be fulfilled in one shipment.
This tutorial shows you how to combine the contents of multiple contracts together on their respective billing cycles.
What you'll learnAnchor link to section titled "What you'll learn"
In this tutorial, you'll learn how to do the following tasks:
- Retrieve a draft of the most up-to-date contract information for a subscription billing cycle
- Combine multiple contracts to the same subscription draft
- Commit the combined contract information
- Fetch the combined contract information on a subscription billing cycle
- Create an order for a subscription billing cycle
RequirementsAnchor link to section titled "Requirements"
- Your app can make authenticated requests to the GraphQL Admin API.
- Your app has the
write_own_subscription_contractsaccess scopes. For more information on requesting access scopes when your app is installed, refer to Getting started with OAuth.
You've created at least two active subscription contracts for the same customer with recurring billing and delivery policies.
You've familiarized yourself with managing billing cycle contracts.
Step 1: Create a subscription draftAnchor link to section titled "Step 1: Create a subscription draft"
You can use the
subscriptionBillingCycleContractEdit mutation to create a subscription draft with the most up-to-date contract information on a specified billing cycle. Choose any one of the subscription contracts to be combined, and pass the contract ID and either the index or a date belonging to the billing cycle to specify the billing cycle.
Make note of the subscription contract draft ID. You'll use it to join additional contracts in the next step.
Step 2: Combine the contractsAnchor link to section titled "Step 2: Combine the contracts"
After retrieving the draft ID, you can combine other contracts to the draft by passing their billing cycles and the draft ID to the
Step 3 (Optional): Update the subscription draftAnchor link to section titled "Step 3 (Optional): Update the subscription draft"
After combining the contracts together, you can update the subscription draft if needed. For example, you might want to add a discount to reward the customer for having multiple subscriptions.
For more information about updating the subscription draft, refer to Manage billing cycle contracts.
Step 4: Commit the subscription draftAnchor link to section titled "Step 4: Commit the subscription draft"
When you commit the subscription draft, the changes that you've made become active on the billing cycles for which the draft was created and for which the contracts were combined. You can call the
subscriptionDraft query to review the information on the subscription draft before committing it.
After you're satisfied with your updates, you can call the
subscriptionBillingCycleContractDraftCommit mutation to commit the changes for all the respective billing cycles for each contract:
Step 5: Fetch the edited contractAnchor link to section titled "Step 5: Fetch the edited contract"
After commiting the subscription draft, you might want to fetch the information on your edited contract.
You can do so using
Step 6: Create an orderAnchor link to section titled "Step 6: Create an order"
When the billing date comes, you can use
subscriptionBillingAttemptCreate mutation on any of the combined contracts to create an order.
billingCycleSelector was specified, Shopify will create an order based on the current billing cycle's contract information by default.
If you want to create an order for a certain billing cycle, you must specify
- Learn how to manage orders and fulfillments for prepaid subscriptions.