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:
Name | Type | Description |
---|---|---|
billingPerson | <billingPerson> object | Customer’s name along with his/her billing address, as entered in the last order. |
String | Email address of a customer | |
id | Number | Unique customer ID in Ecwid |
membership | <CustomerGroup> object | Customer group details. Present only if customer belongs to a customer group |
ownerId | number | Store ID this customer belongs to |
registered | UNIX Timestamp | Registration date of this customer |
shippingAddresses | Array of <ShippingAddress> | A list of addresses in the customer’s address book |
billingPerson:
Name | Type | Description |
---|---|---|
name | string | The first and the last name of the person, separated by a space. |
companyName | string, optional | The person’s company name, if applicable |
street | string, optional | The street address of the person, if applicable. If there are two address lines, they are separated by a newline character ‘\n’ |
city | string, optional | The person’s city, if applicable |
countryCode | string, optional | The person’s country code, as listed in ISO 3166-2 |
postalCode | string, optional | The person’s postal code or ZIP code, if applicable |
stateOrProvinceCode | string, optional | The 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. |
countryName | string, optional | Country name, if applicable |
phone | string, optional | Phone number, if applicable |
CustomerGroup:
Name | Type | Description |
---|---|---|
id | number | The unique id of a customer group |
name | string | Name of the customer group |
ownerid | number | Ecwid store ID |
ShippingAddress:
Name | Type | Description |
---|---|---|
id | integer | The unique address id Ecwid database |
person | Object (Person) | The object describing the address along with the person’s name and phone number. |