# Magento GraphQL customer orders for headless stores in 2026

Use customer { orders } with Bearer tokens, filters, scope, and pagination instead of deprecated customerOrders for Hyva, PWA, and BFF account pages on Adobe Commerce.

- Date: 2026-11-24
- Category: Magento

## Table of contents

- Why Magento GraphQL customer orders matter in 2026
- How Magento GraphQL customer orders work
- Production checklist for Magento GraphQL customer orders
- What breaks when Magento GraphQL customer orders are miswired
- How to measure Magento GraphQL customer orders in production
- Related work on this site
- FAQ
  - What replaced the Magento GraphQL customerOrders query?
  - How do you authenticate Magento GraphQL customer orders?
  - Can Magento GraphQL customer orders search by product name or SKU?
  - When should you use scope STORE, WEBSITE, or GLOBAL on customer orders?

Magento GraphQL customer orders are the read path I use when a Hyva, React, or Next.js account area must list invoices, shipments, and line items without Luma templates. I am Alan Vo, a Gold Coast web developer with 18 years on Adobe Commerce, Shopify, and WooCommerce catalogues. Adobe now steers teams toward the nested `orders` field on the [`customer` query](https://developer.adobe.com/commerce/webapi/graphql/schema/customer/queries/customer) and marks the standalone [`customerOrders`](https://developer.adobe.com/commerce/webapi/graphql/schema/customer/queries/orders) query deprecated. This note is for production BFFs that already mint tokens with `generateCustomerToken` but still ship brittle order history UIs.

## Why Magento GraphQL customer orders matter in 2026

Magento GraphQL customer orders matter in 2026 because account pages are the last place merchants want to rebuild in PHP. Checkout and catalog often move to headless or Hyva first, yet “My orders” still falls back to Luma blocks. Shoppers expect the same filter, search, and pagination patterns they see on Shopify Customer Account API routes or WooCommerce Store API order endpoints. Adobe Commerce GraphQL finally carries filters, sort, scope, shipment nodes, and a `search` term on order lists, so a single BFF can power “recent orders”, order detail, and returns eligibility without REST `GET /V1/orders` sprawl.

Deprecation pressure is real. The root-level `customerOrders` query still resolves in many 2.4.x builds, but schema metadata tells clients to use `customer { orders }`. Greenfield PWAs that codegen against the old query pay migration tax twice. Nested `orders` also shares the same `Customer` resolver context as addresses and wishlist, which simplifies Apollo cache keys: one authenticated `customer` query can hydrate the whole account shell.

Multi-store Adobe Commerce adds a scope argument Adobe documents as `STORE`, `WEBSITE`, or `GLOBAL`. A shopper who bought on the AU store view and the NZ store view under one website needs `scope: WEBSITE` or `GLOBAL` on the account SPA, not only the `Store` header from their last session. Getting scope wrong is a support ticket factory, not a cosmetic bug.

## How Magento GraphQL customer orders work

Magento GraphQL customer orders work when the request carries a valid customer Bearer token and targets `customer.orders`, not the deprecated top-level query.

Authentication follows [GraphQL authorization](https://developer.adobe.com/commerce/webapi/graphql/usage/authorization-tokens): call `generateCustomerToken` with email and password (or an approved one-time password path documented on the mutation), then send `Authorization: Bearer <token>` on every order read. Default customer token lifetime is one hour unless you change **Stores > Configuration > Services > OAuth > Customer Token Lifetime**. Headless apps need refresh or silent re-login flows before shoppers open a six-month-old order PDF.

![Magento GraphQL customer orders catalogue work on a large monitor](../../images/blog/magento-graphql-customer-orders-1.jpg)

The supported shape is:

```graphql
query OrderHistory($pageSize: Int!) {
  customer {
    orders(pageSize: $pageSize, currentPage: 1) {
      total_count
      page_info {
        current_page
        total_pages
      }
      items {
        number
        order_date
        status
        total {
          grand_total {
            value
            currency
          }
        }
      }
    }
  }
}
```

Adobe's schema exposes `CustomerOrdersFilterInput` on `orders`. You can filter by `order_date` ranges, `status`, `number`, and `grand_total`. Sorting uses `CustomerOrderSortInput` with fields such as `NUMBER` and `CREATED_AT` plus a direction enum. For account search boxes, Adobe documents a `search` filter that matches order number or line item product name or SKU, combined with other filters using AND logic. That pattern maps cleanly to a single search box on a React order list.

Order detail pages should narrow with `filter: { number: { eq: "000000001" } }` under `customer.orders`, then request nested `items`, `shipments`, `invoices`, `credit_memos`, and `total` breakdown objects. Adobe's customer query examples show `product_url_key`, quantities, tax rows, and shipping handling blocks. Fetch detail fields only on the detail route. Pulling full shipment trees for twenty rows on the list view will trip query complexity limits and slow Hyva hydration.

The `scope` argument controls how aggressively Magento merges orders across store views. `STORE` (default) respects the `Store` header. `WEBSITE` expands to all store views on that website. `GLOBAL` returns orders across the customer's linked websites. PWAs that let users switch storefront locale without re-auth need explicit scope rules in the BFF, not implicit header luck.

Deprecated `customerOrders` returned a flatter item list with fields like `order_number` and `grand_total` at the top level. Migrating clients should map `number`, `order_date`, and `total.grand_total` on `CustomerOrder`. Update GraphQL codegen and integration tests before deleting the old query from your schema snapshot.

Company and B2B setups may also expose `purchase_orders` on `customer` with separate filters. That path is not interchangeable with consumer `orders`. Route B2B buyers to the purchase order fields your licence enables, or support will see “missing PO” bugs that are really wrong query branches.

Resolver caching is disabled on customer order fields (`@cache(cacheable: false)` in core schema). Do not expect Fastly to cache personalized JSON. Edge-cache only static fragments, not the order list query.

## Production checklist for Magento GraphQL customer orders

A headless account area is ready when tokens, scope, pagination, and error text match what Adobe documents.

1. Confirm **GraphQL** is enabled on production and staging, with the same `Store` header values your PWA sends at checkout.

![Warehouse shelves standing in for a Magento inventory grid](../../images/blog/magento-graphql-customer-orders-2.jpg)

2. Implement **generateCustomerToken** (or your IdP bridge that ends in the same token) and store tokens in httpOnly cookies or secure mobile storage, never in localStorage on shared kiosks.

3. Replace **`customerOrders`** calls with **`customer { orders }`** in every repo. Grep the monorepo for `customerOrders` before merge.

4. Define **list vs detail** queries. List: `number`, `order_date`, `status`, `total.grand_total`, `page_info`. Detail: shipments, items, tax, discounts.

5. Set **pageSize** explicitly (default 20). Infinite scroll should increment `currentPage` until `page_info.total_pages` is reached.

6. Document **scope** rules per website. Test a customer with orders on two store views using `STORE`, `WEBSITE`, and `GLOBAL`.

7. Wire **status filters** to your UI tabs (`complete`, `processing`, etc.) using `filter: { status: { eq: "..." } }`.

8. Implement **search** with the documented `search` string filter plus status if needed. Log slow queries when shoppers search short SKUs.

9. Handle **`The current customer isn't authorized.`** as session expiry. Redirect to login and preserve return URL.

10. Respect **token lifetime** from Admin OAuth settings. Add proactive refresh before one hour idle on account pages.

11. If **Login as Customer** or admin OTC flows are used, follow [generateCustomerToken](https://developer.adobe.com/commerce/webapi/graphql/schema/customer/mutations/generate-token) rules for password vs one-time code precedence and log those sessions separately for PCI reviews.

12. Align **order status labels** with the storefront dictionary. GraphQL returns internal status codes; map them in the BFF for multilingual Hyva or React i18n files.

13. For **returns** widgets, request `eligible_for_return` on line items in the detail query only when the returns extension populates that field.

14. Load-test **detail queries** with full tax and shipping breakdown during peak. Nested resolvers multiply database hits.

15. Pair GraphQL order reads with your existing **[Magento product schema](https://alanvo.com/blog/magento-product-schema/)** and email templates so confirmation links land on the headless order route, not a 404 Luma path.

## What breaks when Magento GraphQL customer orders are miswired

The first break is **calling `customerOrders` in new code**. It works until the next major upgrade removes or alters the resolver. Codegen and mobile apps then fail in production while web still “works” on cached bundles.

The second break is **missing Bearer tokens**. Anonymous `customer` queries return authorization errors. Middleware that strips the `Authorization` header on “GET-like” GraphQL POSTs is a common nginx misconfiguration.

The third break is **wrong scope on multi-store**. A GLOBAL header on a single-store merchant is harmless noise, but `STORE` on a cross-border website hides legitimate orders. QA must use real customer fixtures, not admin-created single-view orders only.

![Boxed products on a packing bench](../../images/blog/magento-graphql-customer-orders-3.jpg)

The fourth break is **over-fetching nested items**. One query that loads `shipments { items { ... } }` for every row in a fifty-order list can hit query complexity limits or time out behind Akamai. Split list and detail operations.

The fifth break is **stale tokens after password reset**. Adobe revokes tokens on password change. Apps that cache tokens in mobile keychains need a forced logout event.

The sixth break is **mixing B2B purchase orders with consumer `orders`**. Company users see PO numbers in a different field tree. UI copy that says “Orders” but queries the wrong branch confuses buyers and finance.

The seventh break is **assuming REST order IDs equal GraphQL `id`**. GraphQL exposes base64-style IDs. Deep links must use `number` or the encoded `id` consistently, not increment integers from old integrations.

## How to measure Magento GraphQL customer orders in production

Magento GraphQL customer orders are measured with auth success rate, query latency, and support parity checks, not vanity traffic metrics.

Track **401/authorization GraphQL errors** on the BFF route that wraps `customer.orders`. Spikes after deploys usually mean cookie domain or Bearer prefix regressions.

Log **p95 latency** separately for list and detail operations. Detail queries with shipments should stay under your SLA budget; if not, trim fields or add DataLoader-style batching in custom resolvers only when Adobe support agrees.

Run **weekly parity scripts**: pick five recent order numbers, fetch REST or Admin totals, and diff `total.grand_total` from GraphQL detail. Currency and tax rounding mismatches belong in finance review, not silent UI rounding.

Monitor **`total_count` vs items length** on paginated lists. Off-by-one pagination bugs show up when `currentPage` is zero-based in the frontend but one-based in GraphQL.

Use **Action Logs** and customer service tags to count “order not visible” tickets before and after scope fixes. That is the business metric executives notice.

For upgrades, add a CI step that parses `schema.graphqls` and fails if `customerOrders` is still referenced in your persisted queries manifest.

## Related work on this site

On [retail conversion](https://alanvo.com/work/retail-conversion/) Magento work, the account area had to show store-credit aware totals without reloading Luma. Moving order reads to `customer { orders }` let the React shell share one token with reorder shortcuts on the PLP. [Arteriors](https://alanvo.com/work/arteriors/) ships large average order values with multiple shipments per order; we limited list queries to headers and loaded shipment tracking only on the detail route so GraphQL stayed inside complexity budgets. [Skanvi](https://alanvo.com/work/skanvi/) Hyva routes benefited from the same pattern: Hyva can hydrate customer context once, then lazy-load order detail when shoppers click through from email links.

![Watch product still used as a Magento PDP example](../../images/blog/magento-graphql-customer-orders-4.jpg)

## FAQ

### What replaced the Magento GraphQL customerOrders query?

Adobe deprecated the root **`customerOrders`** query in favor of **`customer { orders(...) }`** on the [customer query](https://developer.adobe.com/commerce/webapi/graphql/schema/customer/queries/customer). The nested field supports pagination, filters, sort, scope, and richer `CustomerOrder` types including shipments and credit memos. New headless account pages should codegen against `customer.orders` only.

### How do you authenticate Magento GraphQL customer orders?

Send a **customer Bearer token** from `generateCustomerToken` in the `Authorization` header on each GraphQL POST, as described in [GraphQL authorization](https://developer.adobe.com/commerce/webapi/graphql/usage/authorization-tokens). Session cookies still work on some stacks, but Adobe recommends tokens for headless clients. Without a valid token, `customer` order fields return an authorization error.

### Can Magento GraphQL customer orders search by product name or SKU?

Yes. Adobe documents a **`search`** filter on `customer.orders` that matches order number or line item product name or SKU, combined with filters like **`status`** using AND logic. Use it for account search boxes, but keep list queries lean and load heavy line item fields on the detail view only.

### When should you use scope STORE, WEBSITE, or GLOBAL on customer orders?

Use **`STORE`** when the account must mirror a single store view tied to the `Store` header. Use **`WEBSITE`** when shoppers should see orders from every store view on that website. Use **`GLOBAL`** when the customer record spans multiple websites and the business wants one combined order history. Wrong scope is a common reason Magento GraphQL customer orders look “missing” in PWAs even though Admin shows them.


![Retail aisle used while thinking through Magento filters](../../images/blog/magento-graphql-customer-orders-5.jpg)


HTML version: https://alanvo.com/blog/magento-graphql-customer-orders/
