A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I am looking to mark order Fulfilled using GraphQL api.
This is the relevant API documentation I believe:
https://shopify.dev/api/admin-rest/2021-10/resources/fulfillment#top
But this doesn't explain the theory behind fulfilments.
Can anyone share what steps ar involved in marking an order Fulfilled using GraphQL admin API, please?
Looking to mark the whole order as fulfilled at first, then on to partial fulfillements.
Thanks
Solved! Go to the solution
This is an accepted solution.
Answering my own question as usual.
Assuming the order is to be shipped from a single location (which should cover 99% cases), your order will have a single FulfillmentOrder which you need to get the id of
{
order(id:"gid://shopify/Order/123456") {
fulfillmentOrders (first:1) {
edges {
node {
id
}
}
}
}
}
To mark whole order as Fulfilled, use the FulfillmentOrder id to mark the order Fulfilled:
sprintf('
mutation {
fulfillmentCreateV2(
fulfillment: {
lineItemsByFulfillmentOrder:{
fulfillmentOrderId:"%s"
}
notifyCustomer:true
trackingInfo: {
number: "xxx"
url: ""
company: ""
}
}
) {
fulfillment {
id
}
}
}
',
$fulfillment_order_id
);
To mark individual lines, you'll need to use individual LineItem ids.
The documentation:
https://shopify.dev/api/admin-graphql/2021-10/mutations/fulfillmentcreatev2
This is an accepted solution.
Answering my own question as usual.
Assuming the order is to be shipped from a single location (which should cover 99% cases), your order will have a single FulfillmentOrder which you need to get the id of
{
order(id:"gid://shopify/Order/123456") {
fulfillmentOrders (first:1) {
edges {
node {
id
}
}
}
}
}
To mark whole order as Fulfilled, use the FulfillmentOrder id to mark the order Fulfilled:
sprintf('
mutation {
fulfillmentCreateV2(
fulfillment: {
lineItemsByFulfillmentOrder:{
fulfillmentOrderId:"%s"
}
notifyCustomer:true
trackingInfo: {
number: "xxx"
url: ""
company: ""
}
}
) {
fulfillment {
id
}
}
}
',
$fulfillment_order_id
);
To mark individual lines, you'll need to use individual LineItem ids.
The documentation:
https://shopify.dev/api/admin-graphql/2021-10/mutations/fulfillmentcreatev2
Adding to the answer, I had to add the merchant_managed_fulfillment_orders and