Custom input validation
-
Hi, I am trying to check if a specific field contains the number “300”. I tried this code, but it did not work. Does some one here know if I am doing something wrong?
add_action( 'woocommerce_after_checkout_validation', 'misha_validate_fname_lname', 10, 2); function misha_validate_fname_lname( $fields, $errors ){ if ( strpos( $fields[ 'billing_n_matricula' ], 300) === false ){ $errors->add( 'validation', 'Seu número de matrícula parece estar errado, favor digitar o correto.' ); } }
Tks! ??
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Custom input validation’ is closed to new replies.