PHP 클래스 WC_API_Customers

상속: extends WC_API_Resource
파일 보기 프로젝트 열기: woocommerce/woocommerce 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$base string the route base

공개 메소드들

메소드 설명
__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

보호된 메소드들

메소드 설명
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:

비공개 메소드들

메소드 설명
query_customers ( array $args = [] ) : WP_User_Query Helper method to get customer user objects

메소드 상세

__construct() 공개 메소드

Setup class, overridden to provide customer data to order response
부터: 2.1
public __construct ( WC_API_Server $server ) : WC_API_Customers
$server WC_API_Server
리턴 WC_API_Customers

add_customer_data() 공개 메소드

Add customer data to orders
부터: 2.1
public add_customer_data ( $order_data, $order ) : array
$order_data
$order
리턴 array

bulk() 공개 메소드

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()
부터: 2.4.0
public bulk ( array $data ) : array
$data array
리턴 array

create_customer() 공개 메소드

Create a customer
부터: 2.2
public create_customer ( array $data ) : array
$data array
리턴 array

delete_customer() 공개 메소드

Delete a customer
부터: 2.2
public delete_customer ( integer $id ) : array
$id integer the customer ID
리턴 array

edit_customer() 공개 메소드

Edit a customer
부터: 2.2
public edit_customer ( integer $id, array $data ) : array
$id integer the customer ID
$data array
리턴 array

get_customer() 공개 메소드

Get the customer for the given ID
부터: 2.1
public get_customer ( integer $id, array $fields = null ) : array
$id integer the customer ID
$fields array
리턴 array

get_customer() 공개 메소드

Get the customer for the given ID
부터: 2.1
public get_customer ( integer $id, string $fields = null ) : array
$id integer the customer ID
$fields string
리턴 array

get_customer_billing_address() 보호된 메소드

Get customer billing address fields.
부터: 2.2
protected get_customer_billing_address ( ) : array
리턴 array

get_customer_by_email() 공개 메소드

Get the customer for the given email
부터: 2.1
public get_customer_by_email ( string $email, array $fields = null ) : array
$email string the customer email
$fields array
리턴 array

get_customer_downloads() 공개 메소드

Get the available downloads for a customer
부터: 2.2
public get_customer_downloads ( integer $id, string $fields = null ) : array
$id integer the customer ID
$fields string fields to include in response
리턴 array

get_customer_orders() 공개 메소드

Get the orders for a customer
부터: 2.1
public get_customer_orders ( integer $id, string $fields = null ) : array
$id integer the customer ID
$fields string fields to include in response
리턴 array

get_customer_orders() 공개 메소드

Get the orders for a customer
부터: 2.1
public get_customer_orders ( integer $id, string $fields = null, array $filter = [] ) : array
$id integer the customer ID
$fields string fields to include in response
$filter array filters
리턴 array

get_customer_shipping_address() 보호된 메소드

Get customer shipping address fields.
부터: 2.2
protected get_customer_shipping_address ( ) : array
리턴 array

get_customers() 공개 메소드

Get all customers
부터: 2.1
public get_customers ( array $fields = null, array $filter = [], integer $page = 1 ) : array
$fields array
$filter array
$page integer
리턴 array

get_customers_count() 공개 메소드

Get the total number of customers
부터: 2.1
public get_customers_count ( array $filter = [] ) : array
$filter array
리턴 array

is_readable() 보호된 메소드

Check if the current user can read users
또한 보기: WC_API_Resource::is_readable()
부터: 2.1
protected is_readable ( integer | WP_Post $post ) : boolean
$post integer | WP_Post unused
리턴 boolean true if the current user can read users, false otherwise

modify_user_query() 공개 메소드

Modify the WP_User_Query to support filtering on the date the customer was created
부터: 2.1
public modify_user_query ( WP_User_Query $query )
$query WP_User_Query

register_routes() 공개 메소드

GET /customers GET /customers/count GET /customers/ GET /customers//orders
부터: 2.2
public register_routes ( array $routes ) : array
$routes array
리턴 array

update_customer_data() 보호된 메소드

Add/Update customer data.
부터: 2.2
protected update_customer_data ( integer $id, array $data, WC_Customer $customer )
$id integer the customer ID
$data array
$customer WC_Customer

validate_request() 보호된 메소드

1) the ID is a valid integer 2) the ID returns a valid WP_User 3) the current user has the proper permissions
또한 보기: WC_API_Resource::validate_request()
부터: 2.1
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`
리턴 integer | WP_Error valid user ID or WP_Error if any of the checks fails

validate_request() 보호된 메소드

1) the ID is a valid integer 2) the ID returns a valid WP_User 3) the current user has the proper permissions
또한 보기: WC_API_Resource::validate_request()
부터: 2.1
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`
리턴 integer | WP_Error valid user ID or WP_Error if any of the checks fails

프로퍼티 상세

$base 보호되어 있는 프로퍼티

the route base
protected string $base
리턴 string