Customers
Retrieve and modify customers.
Table Specific Information
Select
WooCommerce allows only a small subset of columns to be used in the WHERE clause of a
SELECT query. These columns support only the = comparison, unless stated otherwise. The
available columns for this table are: Id, Email, Role. All other columns are processed client side.
SELECT * FROM Customers WHERE Id = 4 SELECT * FROM Customers WHERE Email = '[email protected]' SELECT * FROM Customers WHERE Username = 'user' AND IsPayingCustomer = true
Update
To introduce new metadata fields which are not present in the schema, the 'MetaDataAggregate' column can be used.
The update below will create two new metadata fields with keys 'key1' and 'key2' and set their respective values.
If any of the keys specified already exists, its value will be updated.
UPDATE Customers SET MetaDataAggregate = 'key1:val1, key2:val2' WHERE ID = 58
Insert
The following attribute is required when performing an insert: Email.
INSERT INTO Customers (Email) VALUES ('[email protected]')
Columns
Name | Type | ReadOnly | References | Description |
Id [KEY] | Long | True |
Unique identifier for the resource. | |
DateCreated | Datetime | True |
The date the customer was created, in the site's timezone. | |
DateModified | Datetime | True |
The date the customer was last modified, in the site's timezone. | |
String | False |
The email address for the customer. | ||
FirstName | String | False |
Customer first name. | |
LastName | String | False |
Customer last name. | |
Role | String | True |
Customer role. | |
Username | String | False |
Customer login name. | |
Password | String | False |
Customer password. write-only | |
IsPayingCustomer | Bool | True |
Is the customer a paying customer? read-only | |
AvatarUrl | String | True |
Avatar URL. | |
MetaDataAggregate | String | False |
Meta data. | |
BillingFirstName | String | False |
First name. | |
BillingLastName | String | False |
Last name. | |
BillingCompany | String | False |
Company name. | |
BillingAddress1 | String | False |
Address line 1 | |
BillingAddress2 | String | False |
Address line 2 | |
BillingCity | String | False |
City name. | |
BillingState | String | False |
ISO code or name of the state, province or district. | |
BillingPostcode | String | False |
Postal code. | |
BillingCountry | String | False |
ISO code of the country. | |
BillingEmail | String | False |
Email address. | |
BillingPhone | String | False |
Phone number. | |
ShippingFirstName | String | False |
First name. | |
ShippingLastName | String | False |
Last name. | |
ShippingCompany | String | False |
Company name. | |
ShippingAddress1 | String | False |
Address line 1 | |
ShippingAddress2 | String | False |
Address line 2 | |
ShippingCity | String | False |
City name. | |
ShippingState | String | False |
ISO code or name of the state, province or district. | |
ShippingPostcode | String | False |
Postal code. | |
ShippingCountry | String | False |
ISO code of the country. |
Pseudo-Columns
SELECT ステートメントのWHERE 句では、疑似カラムフィールドを使用して、データソースから返されるタプルを詳細に制御することができます。
Name | Type | Description |
ReferenceNumber | String |
This column will be used in Bulk operations to get specific values from the Temp tables. |