Build a Pre-order and Try Before You Buy (TBYB) solution
You can create pre-order and TBYB options using the GraphQL Admin API's sellingPlanGroupCreate mutation. This guide describes the requirements for creating pre-order or TBYB options and shows you how to manage them using the GraphQL Admin API.
Anchor to RequirementsRequirements
-
Your app can make authenticated requests to the GraphQL Admin API.
-
Your app has the following access scopes:
-
write_products -
read_all_orders -
read_customer_payment_methods -
read_purchase_options -
write_purchase_options -
read_payment_mandate -
write_payment_mandateLearn how to configure your access scopes using Shopify CLI.
-
-
You've familiarized yourself with selling plans and pre-orders and TBYB.
-
You've created products and product variants in your dev store.
-
The merchant that you're developing for meets the qualifying criteria.
Note- Most subscriptions, pre-order and try before you buy apps need to request API access through the Partner Dashboard. We give API access to apps that are designed according to our [principles for subscriptions, pre-order and TBYB apps] (/docs/apps/selling-strategies/purchase-options#shopifys-principles).
- Public apps that use subscriptions, pre-order or TBYB need to meet specific requirements to be published on the Shopify App Store.
- Custom apps created in the Shopify admin can't use subscriptions, pre-order or TBYB because these apps can't use extensions or request access to protected scopes. If you're building a solution for a single store, then build your custom app in the Partner Dashboard.
Anchor to Step 1: Create pre-order and TBYB optionsStep 1: Create pre-order and TBYB options
Subscriptions, pre-orders, TBYB, and associated records, including SellingPlanGroup, SellingPlan, policies, and associations to products and variants, are deleted 48 hours after a user uninstalls a subscriptions, pre-orders, or TBYB app. Products and product variants aren't deleted. We recommend backing up Subscriptions, pre-orders, and TBYB records in case you need to restore them later.
Create pre-order and TBYB options using the sellingPlanGroupCreate mutation. The SellingPlanGroup object includes one or more SellingPlan objects. The SellingPlan object specifies how a product can be sold.
Learn more about GraphQL Admin API objects for selling plans. For more information on input fields and values, refer to the following resources:
SellingPlan objects are grouped together in Liquid when they are created by the same app, and when they have the same selling_plan_group.name and selling_plan_group.options values. For more information, refer to the selling_plan_group object.
Pre-order
Create a pre-order with a selling plan (SellingPlan) that contains the following policies:
-
Billing (
billingPolicy.fixed): The 20% of the total amount will be charged as a deposit at checkout. The remaining amount will be charged on 2022-07-24. -
Delivery (
deliveryPolicy.fixed): The fulfillment timeline is unknown. -
Pricing (
pricingPolicies.fixed): A 15% product reduction is applied to the variant. -
Inventory (
inventoryPolicy.reserve): The inventory will be updated when the order is fulfilled.The
categoryfield should be set toPRE_ORDER.
POST https://{shop}.myshopify.com/api/{api_version}/graphql.json
GraphQL mutation
JSON response
Try before you buy
Create a try before you buy with a selling plan (SellingPlan) that contains the following policies:
-
Billing (
billingPolicy.fixed): There's no deposit. The full amount will be charged 14 days after checkout. TheremainingBalanceChargeTimeAfterCheckoutvalue must be in ISO 8601 duration format (P14D). -
Delivery (
deliveryPolicy.fixed): The product will be fulfilled as soon as possible. -
Inventory (
inventoryPolicy.reserve): The inventory will be updated when the order is created.The
categoryfield should be set toTRY_BEFORE_YOU_BUY.
POST https://{shop}.myshopify.com/api/{api_version}/graphql.json
GraphQL mutation
JSON response
Create a pre-order with a selling plan (SellingPlan) that contains the following policies:
-
Billing (
billingPolicy.fixed): The 20% of the total amount will be charged as a deposit at checkout. The remaining amount will be charged on 2022-07-24. -
Delivery (
deliveryPolicy.fixed): The fulfillment timeline is unknown. -
Pricing (
pricingPolicies.fixed): A 15% product reduction is applied to the variant. -
Inventory (
inventoryPolicy.reserve): The inventory will be updated when the order is fulfilled.The
categoryfield should be set toPRE_ORDER.
POST https://{shop}.myshopify.com/api/{api_version}/graphql.json
GraphQL mutation
JSON response
Anchor to Step 2 (Optional): Manage pre-order and TBYB optionsStep 2 (Optional): Manage pre-order and TBYB options
Anchor to Associate a pre-order or TBYB option to a product or product variantAssociate a pre-order or TBYB option to a product or product variant
You can use the sellingPlanGroupAddProducts mutation or the sellingPlanGroupAddProductVariants mutation to make a separate request to associate a pre-order or TBYB option with a product or product variant, without having to delete and recreate the pre-order or TBYB option.
Anchor to Associate multiple pre-order or TBYB options to a product or product variantAssociate multiple pre-order or TBYB options to a product or product variant
You can use the productJoinSellingPlanGroups mutation or the productVariantJoinSellingPlanGroups mutation to associate multiple pre-orders or TBYB to a product or product variant.
Anchor to Edit pre-order and TBYB optionsEdit pre-order and TBYB options
You can use the sellingPlanGroupUpdate mutation to edit the attributes associated with a pre-order or TBYB option. For example, you can change the pre-order or TBYB options name.
Anchor to Next stepsNext steps
- Learn about shipping and delivery for pre-orders and TBYB.