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
Hey Mtc_dev
Thank you so much. I need to ask something regarding your query. How do i specify the lines which i need to fulfil?
Here order-> fulfillmentOrders has lineItems but the ID is the actual 'order line Item ID' and not the 'fulfillment Order LineItem ID'.
Hope you would understand my concern.
Hi TonyToms,
In order to fulfill specific line items when creating a Fulfillment for an existing Fulfillment Order, you would want to use the ID from the fulfillmentOrder.lineItems connector. These line item ID's are different from the actual Order line items, and they are actually considered a FulfillmentOrderLineItem object.
If you have the Order that you want to get the specific Fulfillment Order Line Items for, you can do so with the following query:
{
order(id: "gid://shopify/Order/12345678910"){
fulfillmentOrders(first: 10){
edges{
node{
lineItems(first: 50){
edges{
node{
id
}
}
}
}
}
}
}
}
Here's some additional Shopify.dev documentation you can reference as well:
I hope this helps, and I hope you have a great day 🙂
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Adding to the answer, I had to add the merchant_managed_fulfillment_orders and