customer
The signed-in customer, or null for an anonymous session
Returns
| Field | Type | Description |
|---|---|---|
id | ID! | Unique identifier for the customer |
createdAt | DateTime! | Date and time when the customer account was created |
company | String | Company name for business customers |
vatNumber | String | VAT identification number for business customers |
customerNumber | String | Customer number assigned by the back office |
salutation | SalutationType | Optional salutation for the customer |
givenName | String | First name of the customer |
familyName | String | Last name of the customer |
phone | String | The customer's phone number as they typed it: free text, not checked against any numbering plan. Null where none is recorded. |
addresses | AddressResult! | The customer's address book. A search term narrows it by name, company,
street, postal code, city or region; every word must appear, in any
order.
Paged and searchable like a company's book, because a private shopper
can keep as many addresses as a small company -- a facilities manager
buying for forty sites is one person -- and the same picker reads both.Arguments: page, pageSize, searchTerm |
billingAddress | Address | Primary billing address for the customer |
defaultShippingAddress | Address | Primary shipping address for the customer |
notificationPreferences | NotificationPreferences | Marketing and notification opt-in preferences |
businessUnitB2B | BusinessUnit | Get a specific business unit by ID that the customer has access toArguments: id |
businessUnitsB2B | [BusinessUnit!] | List of all business units the customer has access to |
invoice | Invoice | One invoice billed to this person, by id.
The signed-in caller's own, whichever customer this field was reached
through: a Customer is addressable by email, and answering with somebody
else's invoice because their address was asked for is not a question this
should be able to answer.Arguments: id |
invoices | InvoiceResult! | Invoices billed to this person rather than to a company, newest firstArguments: page, pageSize, searchTerm, status, invoiceDateFrom, invoiceDateUntil |
order | Order | One order, by the number a buyer quotes or by its id. Give exactly one --
giving both, or neither, is an error rather than a silent preference.
The id is what a payment provider hands back on its return URL, so it is the
key a buyer arrives with after paying. The order number is the one they read
off a confirmation.Arguments: orderNumber, id |
orders | OrderResult | This customer's orders, newest first. Cancelled ones are left out unless
asked for by name: a cancelled order is not something that was bought, and
reopening an unpaid order for editing cancels it, so the list would
otherwise fill with twins.
A search term matches the order number, the purchase-order reference, or
the SKU of a line item. All three are matched in full rather than as a
prefix: they are codes read off a confirmation, a purchase order or a
packing slip and pasted in, not phrases to type part of.
Product names are deliberately not searched. Free text over what an order
contains needs a separate search index, and an order history that quietly
stops finding anything the day that index is rebuilt is worse than one
that never claimed to.Arguments: page, pageSize, searchTerm, status, createdFrom, createdUntil |
returns | ReturnResult! | The signed-in customer's returns, newest firstArguments: page, pageSize, status |
return | Return | One of the signed-in customer's returns; null when it is not theirsArguments: id |
email | String! | |
shoppingList | ShoppingList | Get a specific shopping list by ID for the customerArguments: id |
shoppingLists | ShoppingListResult | Get paginated shopping lists for the customerArguments: page, pageSize |
Example
query { customer { id email givenName familyName addresses(pageSize: 5, searchTerm: "amsterdam") { items { id givenName familyName city } pagination { totalCount hasNextPage } } } }{ "data": { "customer": { "id": "id-1", "email": "jane@example.com", "givenName": "Example", "familyName": "Example", "addresses": { "items": [ { "id": "id-1", "givenName": "Example", "familyName": "Example", "city": "Example" } ], "pagination": { "totalCount": 1, "hasNextPage": true } } } }}The query is the example the schema documents. The response shows its shape with placeholder values.
Served by
| @evolve-framework/commercetools | Resolved |
| @evolve-framework/medusa | Resolved |
| @evolve-framework/sfcc | Resolved |
Used by
The storefront packages that send it, in these GraphQL documents:
- @evolve-storefront/feature-account:
GetCustomer,GetCustomerAddresses - @evolve-storefront/feature-invoice:
GetCustomerInvoices,GetCustomerInvoiceStatusCounts,GetCustomerInvoice,GetCustomerInvoicePaymentMethods - @evolve-storefront/feature-order:
GetCustomerOrderDeliveryPlan,GetCustomerOrderPaymentMethods,GetCustomerOrders,GetCustomerOrderStatusCounts,GetCustomerOrder,OrderLookupById,OrderLookupByNumber,OrderConfirmationById,GetCustomerOrderLineReviews - @evolve-storefront/feature-return:
GetCustomerReturns,GetCustomerReturn,GetCustomerReturnableLines,GetCustomerReturnableOrders,GetReturnRefundMethods - @evolve-storefront/feature-shopping-list:
GetCustomerShoppingLists,GetCustomerShoppingListDetail

