fulfillmentServiceCreate
Requires access scope. Also: The user must have fulfill_and_ship_orders permission.
Creates a fulfillment service.
Fulfillment service location
When creating a fulfillment service, a new location will be automatically created on the shop and will be associated with this fulfillment service. This location will be named after the fulfillment service and inherit the shop's address.
If you are using API version 2023-10
or later, and you need to specify custom attributes for the fulfillment service location
(for example, to change its address to a country different from the shop's country),
use the
LocationEdit
mutation after creating the fulfillment service.
Arguments
- Anchor to callbackUrlcallback•
Url URL!required The URL to send requests for the fulfillment service. The following considerations apply:
- Shopify queries the
callback_url/fetch_tracking_numbers
endpoint to retrieve tracking numbers for orders, ifis set to
true
. - Shopify queries the
callback_url/fetch_stock
endpoint to retrieve inventory levels, ifis set to
true
. - Shopify uses the
callback_url/fulfillment_order_notification
endpoint to send fulfillment and cancellation requests.
- Shopify queries the
- Anchor to inventoryManagementinventory•
Management BooleanDefault:false Whether the fulfillment service manages product inventory and provides updates to Shopify.
- Anchor to namename•String!required
The name of the fulfillment service.
- Anchor to trackingSupporttracking•
Support BooleanDefault:false Whether the fulfillment service provides tracking numbers for packages.
Deprecated arguments
- Anchor to fulfillmentOrdersOptInfulfillment•
Orders Opt In BooleanDefault:true Whether the fulfillment service uses the fulfillment order based workflow for managing fulfillments.
As of 2022-07 API version, the fulfillment order based workflow is the only way to manage fulfillments. As the migration is now finished, the
property is deprecated and is always set to
true
on correctly functioning fulfillment services.The
input field is deprecated and will be removed in the next API version. This API version makes it optional and defaults to
true
for a smooth migration experience. Do not set theargument, and you are ready for the next API version release.
- Anchor to permitsSkuSharingpermits•
Sku Sharing BooleanDefault:false Whether the fulfillment service can stock inventory alongside other locations.
Anchor to FulfillmentServiceCreatePayload returnsFulfillmentServiceCreatePayload returns
- Anchor to fulfillmentServicefulfillment•
Service The created fulfillment service.
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
- Create a new FulfillmentService
- fulfillmentServiceCreate reference
Examples
mutation fulfillmentServiceCreate($name: String!, $callbackUrl: URL!) {
fulfillmentServiceCreate(name: $name, callbackUrl: $callbackUrl) {
fulfillmentService {
id
serviceName
callbackUrl
}
userErrors {
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation fulfillmentServiceCreate($name: String!, $callbackUrl: URL!) { fulfillmentServiceCreate(name: $name, callbackUrl: $callbackUrl) { fulfillmentService { id serviceName callbackUrl } userErrors { field message } } }",
"variables": {
"name": "example_fulfillment_service",
"callbackUrl": "https://callback.org/"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation fulfillmentServiceCreate($name: String!, $callbackUrl: URL!) {
fulfillmentServiceCreate(name: $name, callbackUrl: $callbackUrl) {
fulfillmentService {
id
serviceName
callbackUrl
}
userErrors {
field
message
}
}
}`,
{
variables: {
"name": "example_fulfillment_service",
"callbackUrl": "https://callback.org/"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation fulfillmentServiceCreate($name: String!, $callbackUrl: URL!) {
fulfillmentServiceCreate(name: $name, callbackUrl: $callbackUrl) {
fulfillmentService {
id
serviceName
callbackUrl
}
userErrors {
field
message
}
}
}`,
"variables": {
"name": "example_fulfillment_service",
"callbackUrl": "https://callback.org/"
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation fulfillmentServiceCreate($name: String!, $callbackUrl: URL!) {
fulfillmentServiceCreate(name: $name, callbackUrl: $callbackUrl) {
fulfillmentService {
id
serviceName
callbackUrl
}
userErrors {
field
message
}
}
}
QUERY
variables = {
"name": "example_fulfillment_service",
"callbackUrl": "https://callback.org/"
}
response = client.query(query: query, variables: variables)