woocommerce_new_customer_data хук-фильтрWC 7.2.0

Filters customer data before a customer account is registered.

This hook filters customer data. It allows user data to be changed, for example, username, password, email, first name, last name, and role.

Использование

add_filter( 'woocommerce_new_customer_data', 'wp_kama_woocommerce_new_customer_data_filter' );

/**
 * Function for `woocommerce_new_customer_data` filter-hook.
 * 
 * @param array $customer_data An array of customer (user) data.
 *
 * @return array
 */
function wp_kama_woocommerce_new_customer_data_filter( $customer_data ){

	// filter...
	return $customer_data;
}
$customer_data(массив)
An array of customer (user) data.

Список изменений

С версии 7.2.0 Введена.

Где вызывается хук

Checkout::create_customer_account()
woocommerce_new_customer_data
wc_create_new_customer()
woocommerce_new_customer_data
woocommerce/src/StoreApi/Routes/V1/Checkout.php 672-683
$new_customer_data = apply_filters(
	'woocommerce_new_customer_data',
	array(
		'user_login' => $username,
		'user_pass'  => $password,
		'user_email' => $user_email,
		'first_name' => $first_name,
		'last_name'  => $last_name,
		'role'       => 'customer',
		'source'     => 'store-api',
	)
);
woocommerce/includes/wc-user-functions.php 96-107
$new_customer_data = apply_filters(
	'woocommerce_new_customer_data',
	array_merge(
		$args,
		array(
			'user_login' => $username,
			'user_pass'  => $password,
			'user_email' => $email,
			'role'       => 'customer',
		)
	)
);

Где используется хук в WooCommerce

Использование не найдено.