Class WC_API_Customers
-
WC_API_Resource
-
WC_API_Customers
Methods summary
public
WC_API_Customers
|
#
__construct( WC_API_Server $server )
Setup class, overridden to provide customer data to order response
Setup class, overridden to provide customer data to order response
Parameters
Returns
Since
2.1
Overrides
|
public
array
|
#
register_routes( array $routes )
Register the routes for this class
Register the routes for this class
GET /customers GET /customers/count GET /customers/<id> GET
/customers/<id>/orders
Parameters
Returns
array
Since
2.1
|
public
array
|
#
get_customers( array $fields = null, array $filter = array(), integer $page = 1 )
Get all customers
Parameters
- $fields
array $fields
- $filter
array $filter
- $page
integer $page
Returns
array
Since
2.1
|
public
array
|
#
get_customer( integer $id, string $fields = null )
Get the customer for the given ID
Get the customer for the given ID
Parameters
- $id
integer $id the customer ID
- $fields
string $fields
Returns
array
Since
2.1
|
public
array
|
#
get_customers_count( array $filter = array() )
Get the total number of customers
Get the total number of customers
Parameters
Returns
array
Since
2.1
|
public
array
|
#
create_customer( array $data )
Create a customer
Parameters
Returns
array
TODO
implement in 2.2 with woocommerce_create_new_customer()
|
public
array
|
#
edit_customer( integer $id, array $data )
Edit a customer
Parameters
- $id
integer $id the customer ID
- $data
array $data
Returns
array
TODO
implement in 2.2
|
public
array
|
#
delete_customer( integer $id )
Delete a customer
Parameters
- $id
integer $id the customer ID
Returns
array
TODO
enable along with PUT/POST in 2.2
|
public
array
|
#
get_customer_orders( integer $id, string $fields = null )
Get the orders for a customer
Get the orders for a customer
Parameters
- $id
integer $id the customer ID
- $fields
string $fields fields to include in response
Returns
array
Since
2.1
|
public
array
|
#
add_customer_data( mixed $order_data, mixed $order )
Add customer data to orders
Add customer data to orders
Parameters
- $order_data
mixed $order_data
- $order
mixed $order
Returns
array
Since
2.1
|
public
|
#
modify_user_query( WP_User_Query $query )
Modify the WP_User_Query to support filtering on the date the customer was
created
Modify the WP_User_Query to support filtering on the date the customer was
created
Parameters
- $query
WP_User_Query $query
Since
2.1
|
protected
integer|WP_Error
|
#
validate_request( string|integer $id, string $type, string $context )
Validate the request by checking:
Validate the request by checking:
- the ID is a valid integer
- the ID returns a valid WP_User
- the current user has the proper permissions
Parameters
- $id
string|integer $id the customer ID
- $type
string $type the request type, unused because this method overrides the parent class
- $context
string $context the context of the request, either read , edit
or delete
Returns
integer|WP_Error valid user ID or WP_Error if any of the checks fails
Since
2.1
See
Overrides
|
protected
boolean
|
#
is_readable( integer|WP_Post $post )
Check if the current user can read users
Check if the current user can read users
Parameters
- $post
integer|WP_Post $post unused
Returns
boolean true if the current user can read users, false otherwise
Since
2.1
See
Overrides
|
delete()
,
filter_response_fields()
,
is_deletable()
,
is_editable()
,
maybe_add_meta()
,
merge_query_args()
Magic methods summary
Properties summary
$server