Listing
useOrders(options?)
Parameterless, it keeps the original flat-list contract:
pageInfo and the options are forwarded to the Storefront connection:
Paged and flat calls use separate cache entries. A screen that shows the
legacy list keeps its cache when another screen paginates.
useInfiniteOrders({ first?, sortBy? })
Cursor-paginated list with an automatic fetchNextPage (TanStack
useInfiniteQuery); pages are flattened into one orders array.
sortBy accepts 'newest' | 'oldest' | 'highest-value' | 'lowest-value'.
The Storefront only exposes PROCESSED_AT and TOTAL_PRICE plus reverse,
which is exactly what these tokens map onto.
useOrderHistory({ sortBy?, first? })
A one-page listing with an explicit onLoadMore() and hasNextPage —
useful when you render your own “Load more” button instead of infinite
scroll.
Status buckets
All three read the same cached page asuseOrders() (one network request,
three views) and filter client-side:
The predicates and filters are pure and exported under the
orders/*
modules (isPendingOrder, isCompletedOrder, isCancelledOrder,
filterOrders), so you can bucket any order list you already hold without a
hook.
Detail
useOrder(orderId)
useOrderTracking(orderId)
Status, tracking numbers/URLs and a derived timeline for one order:
status—cancelled | fulfilled | in-progress | partial | unfulfilled | pending | scheduled | on-hold | restocked. Derived fromcanceledAt/financialStatus/fulfillmentStatus; cancelled always wins.tracking—{ company, numbers: string[], urls: string[] }[], one entry per successful fulfillment that carries tracking.timeline— only the steps Shopify exposes:ordered, oneshippedstep per fulfillment,cancelled. The Storefront API does not expose fulfillment dates, soshippedsteps carry the company, not a timestamp.statusUrl— Shopify’s official order-status page (open it in a browser or web view for the full timeline).
deriveOrderStatus, extractTrackingInfo, deriveOrderTimeline,
hasShipment.
usePrefetchOrders()
Warm the infinite list (and therefore useOrder’s cache) at tap intent:
Order shape
Every node includes:id,name,orderNumber,processedAt,statusUrlfinancialStatus(PAID,PENDING,REFUNDED, …)fulfillmentStatus(FULFILLED,UNFULFILLED, …)canceledAtcurrencyCode,subtotalPrice,totalPrice,currentTotalPrice—{ amount, currencyCode }lineItems(first: 50)—title,quantity,currentQuantity,discountedTotalPrice,originalTotalPrice, andvariant(id,title,price,image)successfulFulfillments—trackingCompanyandtrackingInfo(number,url)
Service API
'Not authenticated' when no access token is set.
getOrdersPage additionally renews a near-expiry token before reading.
