Merge pull request #14566 from woocommerce/fix/14563
Better email handling when invalid
This commit is contained in:
commit
3ef5ad2565
|
@ -626,12 +626,13 @@ class WC_Checkout {
|
|||
}
|
||||
}
|
||||
|
||||
if ( in_array( 'email', $format ) ) {
|
||||
if ( in_array( 'email', $format ) && '' !== $data[ $key ] ) {
|
||||
$data[ $key ] = sanitize_email( $data[ $key ] );
|
||||
|
||||
if ( '' !== $data[ $key ] && ! is_email( $data[ $key ] ) ) {
|
||||
if ( ! is_email( $data[ $key ] ) ) {
|
||||
/* translators: %s: email address */
|
||||
$errors->add( 'validation', sprintf( __( '%s is not a valid email address.', 'woocommerce' ), '<strong>' . $field_label . '</strong>' ) );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue