Property | Type | Description | |
---|---|---|---|
$base | string | the route base |
Method | Description | |
---|---|---|
__construct ( WC_API_Server $server ) : WC_API_Customers | Setup class, overridden to provide customer data to order response | |
add_customer_data ( $order_data, $order ) : array | Add customer data to orders | |
bulk ( array $data ) : array | Bulk update or insert customers Accepts an array with customers in the formats supported by WC_API_Customers->create_customer() and WC_API_Customers->edit_customer() | |
create_customer ( array $data ) : array | Create a customer | |
delete_customer ( integer $id ) : array | Delete a customer | |
edit_customer ( integer $id, array $data ) : array | Edit a customer | |
get_customer ( integer $id, array $fields = null ) : array | Get the customer for the given ID | |
get_customer ( integer $id, string $fields = null ) : array | Get the customer for the given ID | |
get_customer_by_email ( string $email, array $fields = null ) : array | Get the customer for the given email | |
get_customer_downloads ( integer $id, string $fields = null ) : array | Get the available downloads for a customer | |
get_customer_orders ( integer $id, string $fields = null ) : array | Get the orders for a customer | |
get_customer_orders ( integer $id, string $fields = null, array $filter = [] ) : array | Get the orders for a customer | |
get_customers ( array $fields = null, array $filter = [], integer $page = 1 ) : array | Get all customers | |
get_customers_count ( array $filter = [] ) : array | Get the total number of customers | |
modify_user_query ( WP_User_Query $query ) | Modify the WP_User_Query to support filtering on the date the customer was created | |
register_routes ( array $routes ) : array | Register the routes for this class |
Method | Description | |
---|---|---|
get_customer_billing_address ( ) : array | Get customer billing address fields. | |
get_customer_shipping_address ( ) : array | Get customer shipping address fields. | |
is_readable ( integer | WP_Post $post ) : boolean | Check if the current user can read users | |
update_customer_data ( integer $id, array $data, WC_Customer $customer ) | Add/Update customer data. | |
validate_request ( integer $id, string $type, string $context ) : integer | WP_Error | Validate the request by checking: | |
validate_request ( string | integer $id, string $type, string $context ) : integer | WP_Error | Validate the request by checking: |
Method | Description | |
---|---|---|
query_customers ( array $args = [] ) : WP_User_Query | Helper method to get customer user objects |
public __construct ( WC_API_Server $server ) : WC_API_Customers | ||
$server | WC_API_Server | |
return | WC_API_Customers |
public add_customer_data ( $order_data, $order ) : array | ||
$order_data | ||
$order | ||
return | array |
public create_customer ( array $data ) : array | ||
$data | array | |
return | array |
public delete_customer ( integer $id ) : array | ||
$id | integer | the customer ID |
return | array |
protected get_customer_billing_address ( ) : array | ||
return | array |
protected get_customer_shipping_address ( ) : array | ||
return | array |
public get_customers_count ( array $filter = [] ) : array | ||
$filter | array | |
return | array |
protected is_readable ( integer | WP_Post $post ) : boolean | ||
$post | integer | WP_Post | unused |
return | boolean | true if the current user can read users, false otherwise |
public modify_user_query ( WP_User_Query $query ) | ||
$query | WP_User_Query |
public register_routes ( array $routes ) : array | ||
$routes | array | |
return | array |
protected update_customer_data ( integer $id, array $data, WC_Customer $customer ) | ||
$id | integer | the customer ID |
$data | array | |
$customer | WC_Customer |
protected validate_request ( integer $id, string $type, string $context ) : integer | WP_Error | ||
$id | integer | the customer ID |
$type | string | the request type, unused because this method overrides the parent class |
$context | string | the context of the request, either `read`, `edit` or `delete` |
return | integer | WP_Error | valid user ID or WP_Error if any of the checks fails |
protected validate_request ( string | integer $id, string $type, string $context ) : integer | WP_Error | ||
$id | string | integer | the customer ID |
$type | string | the request type, unused because this method overrides the parent class |
$context | string | the context of the request, either `read`, `edit` or `delete` |
return | integer | WP_Error | valid user ID or WP_Error if any of the checks fails |