Phone Field Validation (Multistep)
-
Hi there hope you’re doing good.
I am adding custom phone validation…But when I try to add the wrong input to the phone field it continues with next and in last on clicking place order it shows an error instead of showing in first when I click the next button. It works fine for the required field but on adding custom validation it goes till last.
Below is the code
add_action(‘woocommerce_checkout_process’, ‘custom_validate_billing_phone’);
function custom_validate_billing_phone() {
$is_correct = preg_match(‘/^[0-9]{10}$/D’, $_POST[‘billing_phone’]);
if ( $_POST[‘billing_phone’] && !$is_correct) {
wc_add_notice( __( ‘The Phone field should be between 6 and 20 digits.’ ), ‘error’ );
}
}Please help me with this…
ThanksThe page I need help with: [log in to see the link]
- The topic ‘Phone Field Validation (Multistep)’ is closed to new replies.