Skip to content

Customer Types

TypeScript types of customers and their saved addresses.

The types of this page describe the account of a signed-in customer. The Store API Customers guide describes each attribute and error code, and the SDK Customers page shows the methods that return them.

Customer

Customer is the profile of a customer, returned by GET /store/customers/me and PATCH /store/customers/me for the customer the token belongs to. avatar is a URL: the uploaded picture when avatar_type is storage, a generated picture when it is avatar_ui. birth_date is a YYYY-MM-DD string and email_verified_at an ISO 8601 date, each null when unset. The Store API also sends email_verified, a boolean, and leaves out timezone, last_login_at, last_login_ip and addresses, which the type declares. See Reading the Profile. This is the definition:

interface Customer extends Entity {
  first_name: string | null
  last_name: string
  email: string
  gender: GenderType | null
  phone_number: string | null
  birth_date: string | null
  email_verified_at: string | null
  email_verified?: boolean
  avatar: string
  avatar_type: string
  timezone?: string | null
  opt_in: boolean
  last_login_at: string | null
  last_login_ip?: string | null
  addresses?: Address[]
}

GenderType

GenderType is the gender of a customer. See Gender Type. This is the definition:

enum GenderType {
  MALE = 'male',
  FEMALE = 'female',
}

Address

Address is an address the customer saved in their account, returned by GET /store/customers/me/addresses and the endpoints that save or update one. country_code is the ISO 3166-1 alpha-2 code of the country. A customer has at most one shipping_default and one billing_default address. See Addresses, and Using a Saved Address at Checkout to copy one to a cart. This is the definition:

interface Address extends Entity {
  first_name: string | null
  last_name: string
  full_name?: string
  company_name?: string | null
  street_address: string
  street_address_plus?: string | null
  postal_code: string
  city: string
  state: string | null
  phone_number?: string | null
  type: AddressType
  metadata?: Metadata
  shipping_default: boolean
  billing_default: boolean
  user_id?: ResourceId
  country_id?: ResourceId
  country_code?: string
  country?: Country
}

AddressType

AddressType is the type of a saved address. See Address Type. This is the definition:

enum AddressType {
  BILLING = 'billing',
  SHIPPING = 'shipping',
}

Last updated on

Edit on GitHub