Skip to content

customer

Queryin Customer

The signed-in customer, or null for an anonymous session

Returns

Customer

FieldTypeDescription
idID!Unique identifier for the customer
createdAtDateTime!Date and time when the customer account was created
companyStringCompany name for business customers
vatNumberStringVAT identification number for business customers
customerNumberStringCustomer number assigned by the back office
salutationSalutationTypeOptional salutation for the customer
givenNameStringFirst name of the customer
familyNameStringLast name of the customer
phoneStringThe customer's phone number as they typed it: free text, not checked against any numbering plan. Null where none is recorded.
addressesAddressResult!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
billingAddressAddressPrimary billing address for the customer
defaultShippingAddressAddressPrimary shipping address for the customer
notificationPreferencesNotificationPreferencesMarketing and notification opt-in preferences
businessUnitB2BBusinessUnitGet 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
invoiceInvoiceOne 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
invoicesInvoiceResult!Invoices billed to this person rather than to a company, newest firstArguments: page, pageSize, searchTerm, status, invoiceDateFrom, invoiceDateUntil
orderOrderOne 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
ordersOrderResultThis 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
returnsReturnResult!The signed-in customer's returns, newest firstArguments: page, pageSize, status
returnReturnOne of the signed-in customer's returns; null when it is not theirsArguments: id
emailString!
shoppingListShoppingListGet a specific shopping list by ID for the customerArguments: id
shoppingListsShoppingListResultGet 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
}
}
}
}

The query is the example the schema documents. The response shows its shape with placeholder values.

Served by

@evolve-framework/commercetoolsResolved
@evolve-framework/medusaResolved
@evolve-framework/sfccResolved

Used by

The storefront packages that send it, in these GraphQL documents: