PHP Class WC_Customer_Data_Store

Author: WooThemes
Inheritance: extends WC_Data_Store_WP, implements WC_Customer_Data_Store_Interface, implements WC_Object_Data_Store_Interface
Show file Open project: woocommerce/woocommerce

Protected Properties

Property Type Description
$internal_meta_keys array Data stored in meta keys, but not considered "meta".
$meta_type string Internal meta type used to store user data.

Public Methods

Method Description
create ( &$customer ) Method to create a new customer in the database.
delete ( &$customer, array $args = [] ) Deletes a customer from the database.
get_last_order ( &$customer ) : WC_Order | false Gets the customers last order.
get_order_count ( &$customer ) : integer Return the number of orders this customer has.
get_total_spent ( &$customer ) : float Return how much money this customer has spent.
read ( &$customer ) Method to read a customer object.
search_customers ( string $term ) : array Search customers and return customer IDs.
update ( &$customer ) Updates a customer in the database.

Protected Methods

Method Description
exclude_internal_meta_keys ( object $meta ) : boolean Callback to remove unwanted meta data.

Private Methods

Method Description
update_user_meta ( $customer ) Helper method that updates all the meta for a customer. Used for update & create.

Method Details

create() public method

Method to create a new customer in the database.
Since: 2.7.0
public create ( &$customer )

delete() public method

Deletes a customer from the database.
Since: 2.7.0
public delete ( &$customer, array $args = [] )
$args array Array of args to pass to the delete method.

exclude_internal_meta_keys() protected method

Callback to remove unwanted meta data.
protected exclude_internal_meta_keys ( object $meta ) : boolean
$meta object
return boolean

get_last_order() public method

Gets the customers last order.
Since: 2.7.0
public get_last_order ( &$customer ) : WC_Order | false
return WC_Order | false

get_order_count() public method

Return the number of orders this customer has.
Since: 2.7.0
public get_order_count ( &$customer ) : integer
return integer

get_total_spent() public method

Return how much money this customer has spent.
Since: 2.7.0
public get_total_spent ( &$customer ) : float
return float

read() public method

Method to read a customer object.
Since: 2.7.0
public read ( &$customer )

search_customers() public method

Search customers and return customer IDs.
public search_customers ( string $term ) : array
$term string
return array

update() public method

Updates a customer in the database.
Since: 2.7.0
public update ( &$customer )

Property Details

$internal_meta_keys protected property

Data stored in meta keys, but not considered "meta".
Since: 2.7.0
protected array $internal_meta_keys
return array

$meta_type protected property

Internal meta type used to store user data.
protected string $meta_type
return string