Skip to content

Customers

Returns a cursor-paginated page of your shop’s loyalty customers.

NameTypeRequiredDescription
emailStringNoReturn only customers with this email address.
limitIntNoPage size, 1–1000, default 20.
afterStringNoCursor for the next page.
beforeStringNoCursor for the previous page.
hasCountBooleanNoSet true to include the total count (slower).

An email address can belong to more than one customer, so filtering by email may return several customers. A customer’s identity is always its Shopify customer ID, never its email.

Returns a non-null CustomerConnection, which wraps the page’s items and its pageInfo.

FieldTypeDescription
items[Customer!]!The records for this page.
pageInfoPageInfo!Pagination metadata (see below).

Each item is a Customer:

FieldTypeDescription
idID!The Shopify customer ID (the customer’s identity everywhere).
firstNameStringThe customer’s first name.
lastNameStringThe customer’s last name.
emailStringThe customer’s email address.
stampBalanceIntCurrent redeemable stamp balance.
cardsIntNumber of completed stamp cards.
stampsToNextRewardIntStamps still needed to reach the next reward.
stampsExpireAtStringWhen the current stamp balance expires, if stamp expiry is enabled.
vipTierIdIntCurrent VIP tier ID (if any).
vipTierNameStringCurrent VIP tier name.
dateOfBirthString”dd-mm” string.
stateStringLoyalty state of the customer.
mergedIntoCustomerIdIntIf the customer was merged, the kept customer’s ID.

nextReward is null in the list query; fetch a single customer to populate it (it runs a per-customer query, so it is skipped in lists to avoid N+1 work).

The pageInfo field is a PageInfo:

FieldTypeDescription
hasNextBoolean!Whether another page follows.
hasPreviousBoolean!Whether a previous page exists.
nextCursorStringCursor to fetch the next page (pass as after).
previousCursorStringCursor for the previous page (pass as before).
countIntTotal matching records (only when hasCount: true, otherwise null).
query ($after: String) {
customers(limit: 50, after: $after) {
items { id firstName stampBalance }
pageInfo { hasNext nextCursor }
}
}
{
"data": {
"customers": {
"items": [
{
"id": "6677889900",
"firstName": "Ada",
"stampBalance": 35
}
],
"pageInfo": {
"hasNext": true,
"nextCursor": "eyJpZCI6NjY3Nzg4OTkwMH0="
}
}
}
}

Pass the returned nextCursor back as $after until hasNext is false.

Returns a single customer by their Shopify customer ID.

NameTypeRequiredDescription
idID!YesThe Shopify customer ID.

Returns a Customer object (nullable, null if not found).

FieldTypeDescription
idID!The Shopify customer ID (the customer’s identity everywhere).
firstNameStringThe customer’s first name.
lastNameStringThe customer’s last name.
emailStringThe customer’s email address.
stampBalanceIntCurrent redeemable stamp balance.
cardsIntNumber of completed stamp cards.
stampsToNextRewardIntStamps still needed to reach the next reward.
stampsExpireAtStringWhen the current stamp balance expires, if stamp expiry is enabled.
vipTierIdIntCurrent VIP tier ID (if any).
vipTierNameStringCurrent VIP tier name.
dateOfBirthString”dd-mm” string.
stateStringLoyalty state of the customer.
mergedIntoCustomerIdIntIf the customer was merged, the kept customer’s ID.
nextRewardNextRewardThe next reward the customer is working towards (id and name).
query ($id: ID!) {
customer(id: $id) {
id
firstName
lastName
email
stampBalance
cards
stampsToNextReward
vipTierName
nextReward { id name }
}
}
{
"data": {
"customer": {
"id": "6677889900",
"firstName": "Ada",
"lastName": "Lovelace",
"email": "ada@example.com",
"stampBalance": 35,
"cards": 1,
"stampsToNextReward": 5,
"vipTierName": "Gold",
"nextReward": { "id": "44", "name": "Free coffee" }
}
}
}