WC_Customer_Data_Store::update()publicWC 3.0.0

Updates a customer in the database.

Method of the class: WC_Customer_Data_Store{}

Return

null. Nothing (null).

Usage

$WC_Customer_Data_Store = new WC_Customer_Data_Store();
$WC_Customer_Data_Store->update( $customer );
$customer(WC_Customer) (required) (passed by reference — &)
Customer object.

Changelog

Since 3.0.0 Introduced.

WC_Customer_Data_Store::update() code WC 8.7.0

public function update( &$customer ) {
	wp_update_user(
		apply_filters(
			'woocommerce_update_customer_args',
			array(
				'ID'           => $customer->get_id(),
				'user_email'   => $customer->get_email(),
				'display_name' => $customer->get_display_name(),
			),
			$customer
		)
	);

	// Only update password if a new one was set with set_password.
	if ( $customer->get_password() ) {
		wp_update_user(
			array(
				'ID'        => $customer->get_id(),
				'user_pass' => $customer->get_password(),
			)
		);
		$customer->set_password( '' );
	}

	$this->update_user_meta( $customer );
	$customer->set_date_modified( get_user_meta( $customer->get_id(), 'last_update', true ) );
	$customer->save_meta_data();
	$customer->apply_changes();
	do_action( 'woocommerce_update_customer', $customer->get_id(), $customer );
}