How do you fulfill an order via the graphql API 2010-01?

Solved
Excursionist
16 1 2

Hi, 

 

I want to fulfill an order via the graphql API 2010-01.

I have been looking at the fulfillmentCreateV2 mutation, but it fails, and I am not sure whether the id I provide is correct. The documentation says it should be the id of a "fulfillment order" - is that another id than the usual graphql order id?

I have the following query and variable, where graphqlOrderId is the order id á la 'gid://shopify/Order/1284268326123':

 

const fulfillmentInput = {fulfillment: {lineItemsByFulfillmentOrder: {fulfillmentOrderId: graphqlOrderId}}}
    const query = `mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
      fulfillmentCreateV2(fulfillment: $fulfillment) {
        fulfillment {
          id
        }
        userErrors {
          field
          message
        }
      }
    }`
 
I get the error message "Variable fulfillment of type FulfillmentV2Input! was provided invalid value"
 
Thanks,
-Louise
0 Likes
Highlighted

Success.

Excursionist
16 1 2

It turns out that the order object has one or more fulfillment orders, with ids á la "gid://shopify/FulfillmentOrder/1114134315123", so this id should be used to fulfill the order.

0 Likes
Highlighted
Shopify Staff
Shopify Staff
228 23 26

Hey @Lull,

 

Glad to hear you figured it out. For anyone else that stumbles across this post, note that the admin GraphQL API uses a new concept called FulfillmentOrders. A FulfillmentOrder represents a group of items on a single order which are fulfilled by the same location. This guide does a great job of outlining the concept.

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes