Shopify graphql query assignedFulfillmentOrders filter on order fullyPaid

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.

Hey,

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