Customer Object

Customer object describes details of a logged in customer in a store.

Get customer email and billing country example

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

// prints
// [email protected]
// United States

Fields:

NameTypeDescription
billingPerson<billingPerson> objectCustomer’s name along with his/her billing address, as entered in the last order.
emailStringEmail address of a customer
idNumberUnique customer ID in Ecwid
membership<CustomerGroup> objectCustomer group details. Present only if customer belongs to a customer group
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

billingPerson:

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

CustomerGroup:

NameTypeDescription
idnumberThe unique id of a customer group
namestringName of the customer group
owneridnumberEcwid store ID

ShippingAddress:

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