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}
}
}
}
Parameters:
{
"location": "gid://shopify/Location/999999999",
"status": "FULFILLMENT_UNSUBMITTED",
"first": 250
}
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 found similar questions, unanswered (see Difficulty Filtering Nested GraphQL Fields in Shopify)
But I couldn’t find any answer I was able to apply succesfully to my needs.
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.