Admin GraphQL Customer.numberOfOrders returns 0 while orders contains a paid test order

We are testing a referral integration in a Shopify development store with Admin GraphQL API 2026-07 and read_customers/read_orders access.

Before checkout, the customer’s numberOfOrders was “0” and orders was empty. After a successful Bogus Gateway checkout, the same customer returned numberOfOrders:“0” but orders contained exactly the newly paid order, with test:true and hasNextPage:false. Repeated reads showed the discrepancy. We subsequently fully refunded the test order; the discrepancy persisted. No referral credit was issued.

Minimal query (use a customer ID from your own test store):

query CountDiagnostic($friend: ID!) {
  customer(id: $friend) {
    numberOfOrders
    orders(first: 2) {
      nodes { id test createdAt displayFinancialStatus }
      pageInfo { hasNextPage }
    }
  }
}

Observed structure, with identifiers omitted:

  • numberOfOrders: “0”
  • orders.nodes: exactly one order, test:true, initially PAID and later REFUNDED
  • orders.pageInfo.hasNextPage: false

Questions:

  1. Does Admin Customer.numberOfOrders intentionally exclude test orders, and do cancelled/refunded orders affect it? Is there an official reference?
  2. Is this aggregate eventually consistent? What delay or reconciliation approach is supported?
  3. For first-ever-purchase eligibility, which supported evidence establishes lifetime history? We understand read_orders normally exposes only the last 60 days, so hasNextPage:false alone is not proof of complete lifetime history. How should imported/backdated/deleted orders be treated?

The Customer reference calls numberOfOrders a lifetime count, but does not explain this behavior. We have kept the eligibility safeguard unchanged rather than assuming that report exclusions also govern this API field.

References:

We can supply a request ID and exact resource IDs privately to Shopify staff if needed.

Hey @yingfoowong, you have that correct. Typically, test orders are not counted. This is the same for analytics as well, as you can see in our docs here.

For the other question, since you are building a referral program but may not have access to read_all_orders, would using a customer metafield work? Once they have an order, you add a first purchase metafield. That way, you don’t need to rely on the order history.