custom phone validation in billing address under my account addresses tab
-
I use the following code and put in functions.php but it was not working.
// Limit Woocommerce phone field to 10 digits number
add_action(‘woocommerce_billing_fields’, ‘my_custom_field_process’);function my_custom__field_process() {
// Check if set, if its not set add an error. This one is only requite for companies
if ( ! (preg_match(‘/^[0-9]{10}$/D’, $_POST[‘billing_phone’] ))){
wc_add_notice( “Incorrect Phone Number! Please enter valid 10 digits phone number” ,’error’ );
}
}
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘custom phone validation in billing address under my account addresses tab’ is closed to new replies.