A mutation is used to create fulfillment in Shopify using GraphQL.
The data is passed as variables to the fulfillment orders object obtained for the order.
Mutation:
mutation fulfillmentCreate($input: FulfillmentInput!) {
fulfillmentCreate(fulfillment: $input) {
fulfillment {
id
status
}
userErrors {
field
message
}
}
}
Variable:
{
"input": {
"lineItemsByFulfillmentOrder": [
{
"fulfillmentOrderId": "gid://shopify/FulfillmentOrder/${FULFILLMENT_ORDER_ID}",
"fulfillmentOrderLineItems": [
{
"id": "gid://shopify/FulfillmentOrderLineItem/${FULFILLMENT_ORDER_LINE_ITEM_1}",
"quantity": 1
}
]
}
],
"trackingInfo": {
"number": "1234567890",
"url": "https://www.dhl.com/track?num=1234567890",
"company": "DHL"
},
"notifyCustomer": true
}
}
Response:
{
"data": {
"fulfillmentCreate": {
"fulfillment": {
"id": "gid://shopify/Fulfillment/${FULFILLMENT_ID}",
"status": "SUCCESS"
},
"userErrors": []
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 2000.0,
"currentlyAvailable": 1990,
"restoreRate": 100.0
}
}
}
}