mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
https://stackoverflow.com/questions/70183577/how-to-display-all-validation-error-of-regsitartion-page-at-once-in-woocommerce/70184832
14 lines
600 B
Text
14 lines
600 B
Text
function custom_woocommerce_process_registration_errors( $validation_errors, $username, $password, $email ){
|
|
|
|
if ( !isset( $_POST['email'] ) || $_POST['email'] == '' ) {
|
|
$validation_errors->add( 'email', __( 'Please enter email address.', 'woocommerce' ) );
|
|
}
|
|
|
|
if ( !isset( $_POST['password'] ) || $_POST['password'] == '' ) {
|
|
$validation_errors->add( 'password', __( 'Please enter passwors.', 'woocommerce' ) );
|
|
}
|
|
|
|
return $validation_errors;
|
|
}
|
|
|
|
add_filter( 'woocommerce_process_registration_errors', 'custom_woocommerce_process_registration_errors', 10, 4 );
|