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.
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.
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?
You will need read_merchant_managed_fulfillment_orders scope.
From the docs FulfillmentOrder Requires Any of read_assigned_fulfillment_orders, read_merchant_managed_fulfillment_orders, read_third_party_fulfillment_orders, read_marketplace_fulfillment_orders access scopes.
I tried with read_assigned_fulfillment_orders but I got empty results with no error.
But I got the result with read_merchant_managed_fulfillment_orders.