WC_Customer_Data_Store::delete()publicWC 3.0.0

Deletes a customer from the database.

Method of the class: WC_Customer_Data_Store{}

Hooks from the method

Return

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() code WC 8.7.0

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 );
}