woocommerce_registration_errors filter-hookWC 7.2.0

Filters registration errors before a customer account is registered.

This hook filters registration errors. This can be used to manipulate the array of errors before they are displayed.

Usage

add_filter( 'woocommerce_registration_errors', 'wp_kama_woocommerce_registration_errors_filter', 10, 3 );

/**
 * Function for `woocommerce_registration_errors` filter-hook.
 * 
 * @param \WP_Error $errors     Error object.
 * @param string    $username   Customer username.
 * @param string    $user_email Customer email address.
 *
 * @return \WP_Error
 */
function wp_kama_woocommerce_registration_errors_filter( $errors, $username, $user_email ){

	// filter...
	return $errors;
}
$errors(\WP_Error)
Error object.
$username(string)
Customer username.
$user_email(string)
Customer email address.

Changelog

Since 7.2.0 Introduced.

Where the hook is called

Checkout::create_customer_account()
woocommerce_registration_errors
wc_create_new_customer()
woocommerce_registration_errors
woocommerce/src/StoreApi/Routes/V1/Checkout.php 648
$errors = apply_filters( 'woocommerce_registration_errors', $errors, $username, $user_email );
woocommerce/includes/wc-user-functions.php 90
$errors = apply_filters( 'woocommerce_registration_errors', $errors, $username, $email );

Where the hook is used in WooCommerce

Usage not found.