NAV

Get Customer Details

Find out more about customer that is currently logged in a store.

Customer Object

Customer object describes details of a customer in the store

Get customer email and billing country example

Ecwid.OnSetProfile.add(function(customer) {
  console.log(customer.email);
  console.log(customer.billingPerson.countryName);
})

// prints
// supercoder@matrix.com
// United States

Fields:

NameTypeDescription
billingPerson<Person>Customer’s name along with his/her billing address, as entered in the last order.
emailStringEmail address of a customer
idNumberUnique customer ID in Ecwid
ownerIdnumberStore ID this customer belongs to
registeredUNIX TimestampRegistration date of this customer
shippingAddressesArray of <ShippingAddress>A list of addresses in the customer’s address book

ShippingAddress Object

The customer’s address as stored in the address book.

Fields:

NameTypeDescription
idintegerThe unique address id Ecwid database
personObject (Person)The object describing the address along with the person’s name and phone number.

Person Object

Describes the person name, company and address.

Fields:

NameTypeDescription
namestringThe first and the last name of the person, separated by a space.
companyNamestring, optionalThe person’s company name, if applicable
streetstring, optionalThe street address of the person, if applicable. If there are two address lines, they are separated by a newline character ‘\n’
citystring, optionalThe person’s city, if applicable
countryCodestring, optionalThe person’s country code, as listed in ISO 3166-2
postalCodestring, optionalThe person’s postal code or ZIP code, if applicable
stateOrProvinceCodestring, optionalThe person’s region/state/province code by ISO 3166-2. Please note that not all countries regional codes are listed in the Ecwid database so far.
countryNamestring, optionalCountry name, if applicable
phonestring, optionalPhone number, if applicable