Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

woocommerce validar campos personalizados en el checkout

add_action( 'woocommerce_after_checkout_validation', 'misha_validate_fname_lname', 10, 2);
 
function misha_validate_fname_lname( $fields, $errors ){
 
    if ( preg_match( '/d/', $fields[ 'billing_first_name' ] ) || preg_match( '/d/', $fields[ 'billing_last_name' ] )  ){
        $errors->add( 'validation', 'Your first or last name contains a number. Really?' );
    }
}
 
PREVIOUS NEXT
Tagged: #woocommerce #validar #campos #personalizados #en #el #checkout
ADD COMMENT
Topic
Name
1+9 =