In deprecated REST AdminApi, you had to chain multiple requests (or at least so did I):
get all assignedFulfillmentOrders with status fulfillment_requested
for each, get its orderId
request the api to get this order
check its payment status
then proceed accordingly
New to Shopify GraphQL, I see promising embedded queries and filter possibilities.
I can get everything I need in just one API request: assigned fulfillment request + corresponding order + payment status.
That’s great !
Query:
query assignedFulfillOrders(
$location: ID!,
$status: FulfillmentOrderAssignmentStatus!,
$first: Int
){
assignedFulfillmentOrders(
locationIds: [$location],
assignmentStatus: $status,
first: $first
) {
nodes {
id supportedActions {action}
order {id fullyPaid}
}
}
}
Now my question is: how can I filter the results on the payment status?
I have no interest in a request possibly returning hundreds of orders which I won’t process. Not to mention that these results also come at a cost (requestedQueryCost/actualQueryCost).
I tried to add query:"fullyPaid:true" on nodes, on order, none worked. It seems it’s applicable to orders, but I don’t have such object in my query…
Thanks in advance for your help.
I wonder if you’ve got some options here to try as you are correct that endpoint doesn’t support filtering by payment status so you’d need to check that on your end
Firstly could you do the request the other way around, so query orders for those that have been paid with that fulfillment location id and then filter by status?
Could you use one of the webhooks and then you’d only need to look it up as needed?
Lastly it sounds a little like your operating as a fulfillment service? I might be misunderstanding the use case.
But Shopify does have a guide for that and it includes callbacks to your API when fulfillments are requested so that would again reduce the lookups you need to do
Usecase: you’re right, we’re operating as a fulfillmentService. Our customer wants us to automatically create fulfillmentRequests for ouselves, for each fully paid order assigned to our location. This is why I’m looking for (1) all paid orders (2) assigned to our location (3) for which no fulfillmentRequest has been submitted yet.
We don’t want webhooks, since we don’t like to depend on third party decisions. For instance, if our API could not answer a hook-call, are there retries? How many? How frequent? We prefer being the ones calling Shopify API, and the ones to decide how and when to try again on failure…
Now about requesting orders instead of fulfillmentOrders: I guess you’re right, this should be the solution. I should query orders, with a filter query on financial_status:paid, on fulfillment_location_id:our_location_id, as well as on fulfillment_status… but which status? Unsubmitted does NOT exist for this filter. I’m not sure “open” covers the same cases as “FULFILLMENT_UNSUBMITTED” on an assignedFulfillmentOrders query?