GraphQL - How to set order.fulfillments.displayStatus to "MARKED_AS_FULFILLED"

Hi!

I have an order that I want to mark as fulfilled. In the admin frontend it is as simple as clicking “Mark as fulfilled”.

The json for the order then looks like this:
```json

“displayFulfillmentStatus”: “FULFILLED”,
“fulfillments”: [
{
“id”: “gid://shopify/Fulfillment/6840712003949”,
“displayStatus”: “FULFILLED”,
“events”: {
“nodes”: []
}
}
],
“fulfillmentOrders”: {
“edges”: [],
“nodes”: []
}

```

How can one achieve the same using the GraphQL Admin API?

I couldn’t find any fitting mutations for the Order object. I just found (somewhat contradicting) suggestions:

So, whats the simplest way to mark an order as fulfilled using GraphQL?

You actually do need to use fulfillmentCreate. Every order in Shopify has a FulfillmentOrder attached to it behind the scenes now (they forced this migration a while back).

If your fulfillmentOrders array is coming back empty in your query, double-check how you’re querying it. Are you filtering by status? If the order is unfulfilled, the FulfillmentOrder status will be OPEN.

Basically the flow is:

  1. Query the Order to get its fulfillmentOrders (grab the ID).
  2. Run the fulfillmentCreate mutation using that ID.

You don’t need to mess with fulfillment events just to mark it fulfilled. Just get that fulfillment order ID first.

Thanks for the clarifying answer.

I figured it out now, why the fulfillmentOrders array came back empty. My query was correct, but my app didn’t have the right access scope :upside_down_face: (This info is also buried deep in the docs https://shopify.dev/docs/api/admin-graphql/latest/connections/FulfillmentOrderConnection.)

After I gave it all access scopes regarding fulfillment_orders the fulfillmentOrders were present. (However, I’m still not sure which was the correct access scope.)