# Customer - storefront - OBJECT Version: 2024-10 ## Description A customer represents a customer account with the shop. Customer accounts store contact information for the customer, saving logged-in customers the trouble of having to provide it at every checkout. ### Access Scopes `unauthenticated_read_customers` access scope. ## Fields * [acceptsMarketing](/docs/api/storefront/2024-10/scalars/Boolean): Boolean! - Indicates whether the customer has consented to be sent marketing material via email. * [createdAt](/docs/api/storefront/2024-10/scalars/DateTime): DateTime! - The date and time when the customer was created. * [defaultAddress](/docs/api/storefront/2024-10/objects/MailingAddress): MailingAddress - The customer’s default address. * [displayName](/docs/api/storefront/2024-10/scalars/String): String! - The customer’s name, email or phone number. * [email](/docs/api/storefront/2024-10/scalars/String): String - The customer’s email address. * [firstName](/docs/api/storefront/2024-10/scalars/String): String - The customer’s first name. * [id](/docs/api/storefront/2024-10/scalars/ID): ID! - A unique ID for the customer. * [lastName](/docs/api/storefront/2024-10/scalars/String): String - The customer’s last name. * [metafield](/docs/api/storefront/2024-10/objects/Metafield): Metafield - Returns a metafield found by namespace and key. * [metafields](/docs/api/storefront/2024-10/objects/Metafield): Metafield! - The metafields associated with the resource matching the supplied list of namespaces and keys. * [numberOfOrders](/docs/api/storefront/2024-10/scalars/UnsignedInt64): UnsignedInt64! - The number of orders that the customer has made at the store in their lifetime. * [phone](/docs/api/storefront/2024-10/scalars/String): String - The customer’s phone number. * [tags](/docs/api/storefront/2024-10/scalars/String): String! - A comma separated list of tags that have been added to the customer. Additional access scope required: unauthenticated_read_customer_tags. * [updatedAt](/docs/api/storefront/2024-10/scalars/DateTime): DateTime! - The date and time when the customer information was updated. ## Connections * [addresses](/docs/api/storefront/2024-10/connections/MailingAddressConnection): MailingAddressConnection! * [orders](/docs/api/storefront/2024-10/connections/OrderConnection): OrderConnection! ## Related queries * [customer](/docs/api/storefront/2024-10/queries/customer) The customer associated with the given access token. Tokens are obtained by using the [`customerAccessTokenCreate` mutation](https://shopify.dev/docs/api/storefront/latest/mutations/customerAccessTokenCreate). ## Related mutations * [customerActivateByUrl](/docs/api/storefront/2024-10/mutations/customerActivateByUrl) Activates a customer with the activation url received from `customerCreate`. * [customerActivate](/docs/api/storefront/2024-10/mutations/customerActivate) Activates a customer. * [customerCreate](/docs/api/storefront/2024-10/mutations/customerCreate) Creates a new customer. * [customerDefaultAddressUpdate](/docs/api/storefront/2024-10/mutations/customerDefaultAddressUpdate) Updates the default address of an existing customer. * [customerResetByUrl](/docs/api/storefront/2024-10/mutations/customerResetByUrl) "Resets a customer’s password with the reset password URL received from a reset password email. You can send a reset password email with the [`customerRecover`](https://shopify.dev/api/storefront/latest/mutations/customerRecover) mutation." * [customerReset](/docs/api/storefront/2024-10/mutations/customerReset) "Resets a customer’s password with the token received from a reset password email. You can send a reset password email with the [`customerRecover`](https://shopify.dev/api/storefront/latest/mutations/customerRecover) mutation." * [customerUpdate](/docs/api/storefront/2024-10/mutations/customerUpdate) Updates an existing customer. ## Related Unions * [MetafieldParentResource](/docs/api/storefront/2024-10/unions/MetafieldParentResource) A resource that the metafield belongs to. ## Examples ### Get a customer by access token Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \\\n-d '{\n\"query\": \"query { customer(customerAccessToken: \\\"bobs_token\\\") { id firstName lastName acceptsMarketing email phone } }\"\n}'\n" Node example: "const client = new shopify.clients.Storefront({\n domain: 'your-development-store.myshopify.com',\n storefrontAccessToken,\n});\nconst data = await client.query({\n data: `query {\n customer(customerAccessToken: \"bobs_token\") {\n id\n firstName\n lastName\n acceptsMarketing\n email\n phone\n }\n }`,\n});\n" Ruby example: null Remix example: "const { storefront } = await unauthenticated.storefront(\n 'your-development-store.myshopify.com'\n);\n\nconst response = await storefront.graphql(\n `#graphql\n query {\n customer(customerAccessToken: \"bobs_token\") {\n id\n firstName\n lastName\n acceptsMarketing\n email\n phone\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n customer(customerAccessToken: \"bobs_token\") {\n id\n firstName\n lastName\n acceptsMarketing\n email\n phone\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "customer": { "id": "gid://shopify/Customer/410535040", "firstName": "John", "lastName": "Smith", "acceptsMarketing": false, "email": "johnsmith@example.com", "phone": "+16134504533" } } }