Obtain count of fulfilled orders by customer

Hello,

I’m trying to obtain the number of orders that a customer has made and we’ve fulfilled. I’ve tried using the ‘numberOfOrders’ attribute but this also counts orders that have been created but not yet fulfilled.

Is there an easy way to obtain this number without having to make a paginated GraphQL query that filters by fulfillment_status and customer_id?

Thank you in advance

Hi,

Hope this will help

GraphQL query

{
  customer(id: "CUSTOMER_ID") {
    orders(query: "fulfillment_status:fulfilled") {
      totalCount
    }
  }
}

Replace “CUSTOMER_ID” with the actual ID

Thank you for your answer, but this returns the following error:

“message”: “Field ‘totalCount’ doesn’t exist on type ‘OrderConnection’”