Build delivery profiles
You can use delivery profiles to manage advanced shipping information in Shopify. Shops that use delivery profiles gain the ability to create shipping rates per product variant and location.
This guide shows you how to manage delivery profiles for pre-orders and Try before you buy (TBYB).
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_mandate
Learn how to configure your access scopes using Shopify CLI.
-
- You've completed the Create and manage pre-orders and TBYB options guide.
- 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 delivery profilesStep 1: Create delivery profiles
A delivery profile is a set of shipping rates scoped to a set of products or variants that can be shipped from selected locations to zones. You can associate the DeliveryProfile
with the SellingPlanGroup
object to do the following tasks:
- Set free shipping for all orders with pre-orders or TBYB
- Restrict shipping to specific countries
- Set a flat shipping rate by country for all orders with pre-orders or TBYB
Anchor to Set free shippingSet free shipping
You can set free shipping for all orders with a pre-order or TBYB. The following example uses the deliveryProfileCreate
mutation to set free shipping.
POST https://{shop}.myshopify.com/api/{api_version}/graphql.json
GraphQL mutation
JSON response
Anchor to Restrict shipping to specific countriesRestrict shipping to specific countries
You can restrict pre-orders and TBYB shipping to specific countries regardless of which delivery zones you have configured in the Shopify admin. The following example restricts shipping to North America (Canada, United States, Mexico):
POST https://{shop}.myshopify.com/api/{api_version}/graphql.json
GraphQL mutation
JSON response
Anchor to Set a flat shipping rate by countrySet a flat shipping rate by country
You can set a flat shipping rate by delivery zone for all orders with pre-orders and TBYB. The following example defines free shipping to Canada and defines a $15.00 flat shipping rate for the rest of the world:
POST https://{shop}.myshopify.com/api/{api_version}/graphql.json
GraphQL mutation
JSON response
Anchor to Step 2: Retrieve delivery profilesStep 2: Retrieve delivery profiles
You can use the deliveryProfiles
query to retrieve a list of delivery profiles.
The following query returns a delivery profile with its ID, name, and default setting. Product variants stay in the default profile until they are added to another delivery profile. The example response indicates that the default profile is returned.
POST https://{shop}.myshopify.com/api/{api_version}/graphql.json
GraphQL query
JSON response
Anchor to Step 3: Update delivery profilesStep 3: Update delivery profiles
You can use the deliveryProfileUpdate
mutation to update existing delivery profiles. The following example adds the United States delivery zone:
POST https://{shop}.myshopify.com/api/{api_version}/graphql.json
GraphQL mutation
JSON response
Anchor to Step 4 (Optional): Remove a delivery profileStep 4 (Optional): Remove a delivery profile
You can asynchronously remove a delivery profile by using the deliveryProfileRemove
mutation, and passing in the ID of the delivery profile that you want to remove. The response returns a job ID that you can use to check on the job status and determine whether the operation is complete:
- If
done
istrue
, then the removal of the delivery profile has completed. - If
done
isfalse
, then removal of the delivery profile is still in progress.
POST https://{shop}.myshopify.com/api/{api_version}/graphql.json
GraphQL mutation
JSON response
Anchor to Next stepsNext steps
- Learn how to set up required access scopes and pages for your pre-orders and TBYB app.