WC_Customer_Data_Store::delete
Deletes a customer from the database.
Method of the class: WC_Customer_Data_Store{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$WC_Customer_Data_Store = new WC_Customer_Data_Store(); $WC_Customer_Data_Store->delete( $customer, $args );
- $customer(WC_Customer) (required) (passed by reference — &)
- Customer object.
- $args(array)
- Array of args to pass to the delete method.
Default: array()
Changelog
| Since 3.0.0 | Introduced. |
WC_Customer_Data_Store::delete() WC Customer Data Store::delete code WC 10.3.3
public function delete( &$customer, $args = array() ) {
if ( ! $customer->get_id() ) {
return;
}
$args = wp_parse_args(
$args,
array(
'reassign' => 0,
)
);
$id = $customer->get_id();
wp_delete_user( $id, $args['reassign'] );
do_action( 'woocommerce_delete_customer', $id );
}