Covers all questions related to inventory management, order fulfillment, and shipping.
Hi,
I'm having trouble with the graphQL API (2020-10)
For this simple query I'm running to get FulfillmentOrders for an Order:
query order($id: ID!) {
order(id: $id) {
createdAt
fulfillmentOrders(first: 10) {
edges {
node {
assignedLocation {
location {
id
}
}
}
}
}
}
}
This Query works perfectly on the Shopify GraphiQL App.
But when running on my Custom app, fulfillmentOrders always returns empty edges!
The app has the appropriate access, and can return all the other different properties of an Order.
Is there an issue going on with the API?
Thanks
Solved! Go to the solution
This is an accepted solution.
Update. Gave up and went with the REST solution at https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillmentorder
There is definitely a bug in the GraphQL API that doesn't give you permission to see locations that aren't default. And it's even more annoying that it works perfectly in Shopify GraphiQL App. So you're convinced it is a problem in your code. Shame I spent a whole day on this.
Update. I have found that the assignedLocations will only be populated if our default Location is used in that order. So if 2 locations were used, it will only return 1.
If a location was used that wasn't the default location, it will return blank.
Any idea why this is?
This is an accepted solution.
Update. Gave up and went with the REST solution at https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillmentorder
There is definitely a bug in the GraphQL API that doesn't give you permission to see locations that aren't default. And it's even more annoying that it works perfectly in Shopify GraphiQL App. So you're convinced it is a problem in your code. Shame I spent a whole day on this.
I've been fighting with this issue recently, thinking it was a problem in the GraphQL client library I was using (dotnet) or in the JSON deserialization. I had even given up for a several weeks and moved on to other dev items. I came back to it tonight and found this thread, and it gave me an idea. The GraphQL app has full permissions, so I started looking at the private app API token I was using, and after a bit of experimentation, discovered that once I granted the "Merchant-managed fulfillment orders" Read Access, the fulfillmentOrders collection was being returned properly and deserialized properly in my app code.
Before:
After:
Hope this helps anyone else fighting this problem. The docs could probably be clearer about which token permissions are needed for a given edge of the graph API.
I am glad I found this thread, because I was seeing the same issue. The fulfillmentOrders appeared once I had requested the merchant_managed_fulfillment_orders scope.
I would still suggest this is a bug though. Surely adding the fulfillmentOrders field to the Order query should result in a permission error which I believe
is the case if assigned_fulfillment_orders scope is not requested.
Agreed. Throwing a security error here, rather than just not returning that segment of the graph, would have been significantly better and saved me tens of hours of chasing the wild goose of deserialization problems. Any way we can tag a Shopify staffer to call their attention to this thread?
For those that didn't give up on Graphql, like so many of us have desperately wanted to do. This is the correct answer.
Shopify should add what permissions you need for each object in the Graphql documentation.
Thank you! Wow that was annoying. Another documentation fail.