Fulfill a fulfillment order with tracking info and notify the customer
Description
Fulfill every remaining line item of a fulfillment order, add tracking info, and send the customer a shipping
confirmation. `notifyCustomer` defaults to `false`, so set it to `true` to send the notification.
The carrier in this example isn't a
[supported tracking company](https://shopify.dev/api/admin-graphql/latest/objects/FulfillmentTrackingInfo#supported-tracking-companies),
so the tracking URL is passed in `url`. For a supported company, Shopify builds the URL from the tracking number.
The app needs the `write_assigned_fulfillment_orders`, `write_merchant_managed_fulfillment_orders` or
`write_third_party_fulfillment_orders` access scope, and the user needs the `fulfill_and_ship_orders` permission.
Query
mutation FulfillmentCreateWithTracking($fulfillment: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $fulfillment) {
fulfillment {
id
status
trackingInfo(first: 10) {
company
number
url
}
}
userErrors {
field
message
}
}
}
Variables
{
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820"
}
],
"trackingInfo": {
"company": "Example Couriers",
"number": "EC1234567890",
"url": "https://tracking.example.com/track?number=EC1234567890"
},
"notifyCustomer": true
}
}
cURL
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation FulfillmentCreateWithTracking($fulfillment: FulfillmentInput!) { fulfillmentCreate(fulfillment: $fulfillment) { fulfillment { id status trackingInfo(first: 10) { company number url } } userErrors { field message } } }",
"variables": {
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820"
}
],
"trackingInfo": {
"company": "Example Couriers",
"number": "EC1234567890",
"url": "https://tracking.example.com/track?number=EC1234567890"
},
"notifyCustomer": true
}
}
}'
React Router
import { authenticate } from "../shopify.server";
export const loader = async ({request}) => {
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation FulfillmentCreateWithTracking($fulfillment: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $fulfillment) {
fulfillment {
id
status
trackingInfo(first: 10) {
company
number
url
}
}
userErrors {
field
message
}
}
}`,
{
variables: {
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820"
}
],
"trackingInfo": {
"company": "Example Couriers",
"number": "EC1234567890",
"url": "https://tracking.example.com/track?number=EC1234567890"
},
"notifyCustomer": true
}
},
},
);
const json = await response.json();
return json.data;
}
Ruby
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 FulfillmentCreateWithTracking($fulfillment: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $fulfillment) {
fulfillment {
id
status
trackingInfo(first: 10) {
company
number
url
}
}
userErrors {
field
message
}
}
}
QUERY
variables = {
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820"
}
],
"trackingInfo": {
"company": "Example Couriers",
"number": "EC1234567890",
"url": "https://tracking.example.com/track?number=EC1234567890"
},
"notifyCustomer": true
}
}
response = client.query(query: query, variables: variables)
Node.js
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation FulfillmentCreateWithTracking($fulfillment: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $fulfillment) {
fulfillment {
id
status
trackingInfo(first: 10) {
company
number
url
}
}
userErrors {
field
message
}
}
}`,
"variables": {
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820"
}
],
"trackingInfo": {
"company": "Example Couriers",
"number": "EC1234567890",
"url": "https://tracking.example.com/track?number=EC1234567890"
},
"notifyCustomer": true
}
},
},
});
Shopify CLI
shopify app execute \
--query \
'mutation FulfillmentCreateWithTracking($fulfillment: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $fulfillment) {
fulfillment {
id
status
trackingInfo(first: 10) {
company
number
url
}
}
userErrors {
field
message
}
}
}' \
--variables \
'{
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820"
}
],
"trackingInfo": {
"company": "Example Couriers",
"number": "EC1234567890",
"url": "https://tracking.example.com/track?number=EC1234567890"
},
"notifyCustomer": true
}
}'
Direct API Access
const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
method: 'POST',
body: JSON.stringify({
query: `
mutation FulfillmentCreateWithTracking($fulfillment: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $fulfillment) {
fulfillment {
id
status
trackingInfo(first: 10) {
company
number
url
}
}
userErrors {
field
message
}
}
}
`,
variables: {
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820"
}
],
"trackingInfo": {
"company": "Example Couriers",
"number": "EC1234567890",
"url": "https://tracking.example.com/track?number=EC1234567890"
},
"notifyCustomer": true
}
},
}),
});
const { data } = await response.json();
console.log(data);
Response
{
"fulfillmentCreate": {
"fulfillment": {
"id": "gid://shopify/Fulfillment/1069019861",
"status": "SUCCESS",
"trackingInfo": [
{
"company": "Example Couriers",
"number": "EC1234567890",
"url": "https://tracking.example.com/track?number=EC1234567890"
}
]
},
"userErrors": []
}
}
Partially fulfill line items from two fulfillment orders with an origin address
Description
Create one fulfillment from two fulfillment orders, and record the address that the items ship from. The
fulfillment orders must belong to the same order and be assigned to the same location.
For the first fulfillment order, `fulfillmentOrderLineItems` fulfills 2 of the 10 units of one line item.
The second fulfillment order omits `fulfillmentOrderLineItems`, so every remaining item in it is fulfilled.
The app needs the `write_assigned_fulfillment_orders`, `write_merchant_managed_fulfillment_orders` or
`write_third_party_fulfillment_orders` access scope, and the user needs the `fulfill_and_ship_orders` permission.
To read the `fulfillmentLineItems` and `originAddress` fields in the response, the app also needs the
`read_orders`, `read_marketplace_orders` or `read_buyer_membership_orders` access scope.
Query
mutation FulfillmentCreatePartial($fulfillment: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $fulfillment) {
fulfillment {
id
status
fulfillmentLineItems(first: 10) {
nodes {
quantity
lineItem {
title
}
}
}
originAddress {
address1
city
provinceCode
countryCode
zip
}
}
userErrors {
field
message
}
}
}
Variables
{
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820",
"fulfillmentOrderLineItems": [
{
"id": "gid://shopify/FulfillmentOrderLineItem/1072503286",
"quantity": 2
}
]
},
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000821"
}
],
"originAddress": {
"address1": "123 Example Street",
"city": "Ottawa",
"provinceCode": "ON",
"countryCode": "CA",
"zip": "K1A 0A1"
}
}
}
cURL
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation FulfillmentCreatePartial($fulfillment: FulfillmentInput!) { fulfillmentCreate(fulfillment: $fulfillment) { fulfillment { id status fulfillmentLineItems(first: 10) { nodes { quantity lineItem { title } } } originAddress { address1 city provinceCode countryCode zip } } userErrors { field message } } }",
"variables": {
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820",
"fulfillmentOrderLineItems": [
{
"id": "gid://shopify/FulfillmentOrderLineItem/1072503286",
"quantity": 2
}
]
},
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000821"
}
],
"originAddress": {
"address1": "123 Example Street",
"city": "Ottawa",
"provinceCode": "ON",
"countryCode": "CA",
"zip": "K1A 0A1"
}
}
}
}'
React Router
import { authenticate } from "../shopify.server";
export const loader = async ({request}) => {
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation FulfillmentCreatePartial($fulfillment: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $fulfillment) {
fulfillment {
id
status
fulfillmentLineItems(first: 10) {
nodes {
quantity
lineItem {
title
}
}
}
originAddress {
address1
city
provinceCode
countryCode
zip
}
}
userErrors {
field
message
}
}
}`,
{
variables: {
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820",
"fulfillmentOrderLineItems": [
{
"id": "gid://shopify/FulfillmentOrderLineItem/1072503286",
"quantity": 2
}
]
},
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000821"
}
],
"originAddress": {
"address1": "123 Example Street",
"city": "Ottawa",
"provinceCode": "ON",
"countryCode": "CA",
"zip": "K1A 0A1"
}
}
},
},
);
const json = await response.json();
return json.data;
}
Ruby
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 FulfillmentCreatePartial($fulfillment: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $fulfillment) {
fulfillment {
id
status
fulfillmentLineItems(first: 10) {
nodes {
quantity
lineItem {
title
}
}
}
originAddress {
address1
city
provinceCode
countryCode
zip
}
}
userErrors {
field
message
}
}
}
QUERY
variables = {
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820",
"fulfillmentOrderLineItems": [
{
"id": "gid://shopify/FulfillmentOrderLineItem/1072503286",
"quantity": 2
}
]
},
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000821"
}
],
"originAddress": {
"address1": "123 Example Street",
"city": "Ottawa",
"provinceCode": "ON",
"countryCode": "CA",
"zip": "K1A 0A1"
}
}
}
response = client.query(query: query, variables: variables)
Node.js
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation FulfillmentCreatePartial($fulfillment: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $fulfillment) {
fulfillment {
id
status
fulfillmentLineItems(first: 10) {
nodes {
quantity
lineItem {
title
}
}
}
originAddress {
address1
city
provinceCode
countryCode
zip
}
}
userErrors {
field
message
}
}
}`,
"variables": {
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820",
"fulfillmentOrderLineItems": [
{
"id": "gid://shopify/FulfillmentOrderLineItem/1072503286",
"quantity": 2
}
]
},
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000821"
}
],
"originAddress": {
"address1": "123 Example Street",
"city": "Ottawa",
"provinceCode": "ON",
"countryCode": "CA",
"zip": "K1A 0A1"
}
}
},
},
});
Shopify CLI
shopify app execute \
--query \
'mutation FulfillmentCreatePartial($fulfillment: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $fulfillment) {
fulfillment {
id
status
fulfillmentLineItems(first: 10) {
nodes {
quantity
lineItem {
title
}
}
}
originAddress {
address1
city
provinceCode
countryCode
zip
}
}
userErrors {
field
message
}
}
}' \
--variables \
'{
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820",
"fulfillmentOrderLineItems": [
{
"id": "gid://shopify/FulfillmentOrderLineItem/1072503286",
"quantity": 2
}
]
},
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000821"
}
],
"originAddress": {
"address1": "123 Example Street",
"city": "Ottawa",
"provinceCode": "ON",
"countryCode": "CA",
"zip": "K1A 0A1"
}
}
}'
Direct API Access
const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
method: 'POST',
body: JSON.stringify({
query: `
mutation FulfillmentCreatePartial($fulfillment: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $fulfillment) {
fulfillment {
id
status
fulfillmentLineItems(first: 10) {
nodes {
quantity
lineItem {
title
}
}
}
originAddress {
address1
city
provinceCode
countryCode
zip
}
}
userErrors {
field
message
}
}
}
`,
variables: {
"fulfillment": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000820",
"fulfillmentOrderLineItems": [
{
"id": "gid://shopify/FulfillmentOrderLineItem/1072503286",
"quantity": 2
}
]
},
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/1046000821"
}
],
"originAddress": {
"address1": "123 Example Street",
"city": "Ottawa",
"provinceCode": "ON",
"countryCode": "CA",
"zip": "K1A 0A1"
}
}
},
}),
});
const { data } = await response.json();
console.log(data);
Response
{
"fulfillmentCreate": {
"fulfillment": {
"id": "gid://shopify/Fulfillment/1069019861",
"status": "SUCCESS",
"fulfillmentLineItems": {
"nodes": [
{
"quantity": 2,
"lineItem": {
"title": "Crafty Shoes - Green"
}
},
{
"quantity": 1,
"lineItem": {
"title": "Element"
}
}
]
},
"originAddress": {
"address1": "123 Example Street",
"city": "Ottawa",
"provinceCode": "ON",
"countryCode": "CA",
"zip": "K1A 0A1"
}
},
"userErrors": []
}
}