Happening now | Office Hours: Customizing Your Theme With Moeed | Ask your questions now!

Obtain count of fulfilled orders by customer

Obtain count of fulfilled orders by customer

joelurraco
Shopify Partner
22 0 15

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

Replies 2 (2)

Small_Task_Help
Shopify Partner
1103 51 108

Hi,

 

Hope this will help 

 

GraphQL query

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

Replace "CUSTOMER_ID" with the actual ID

To Get Shopify Experts Help, Click Here or E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Expert India
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad
joelurraco
Shopify Partner
22 0 15

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

 

"message": "Field 'totalCount' doesn't exist on type 'OrderConnection'"