• Resolved man123an

    (@man123an)


    mobile number field at checkout doesn’t have any limit option. There were many fake order because of this. How to limit it to 10 digit. please answer me as soon as you can cause my website is live

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    Please add code in the functions.php file.

    add_action('woocommerce_checkout_process', 'my_custom_checkout_field_process');
      
    function my_custom_checkout_field_process() {
        global $woocommerce;
      	if ( ! (preg_match('/^[0-9]{10}$/D', $_POST['billing_phone'] ))){
            wc_add_notice( "Incorrect Phone Number! Please enter valid 10 digits phone number"  ,'error' );
        }
    }

    Thank you

    It looks like it’s you may have found a solution to this. I am going to mark this as Resolved at this time. If you have another issue please feel free to open a new post. ??

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Mobile No. field is taking any number as input’ is closed to new replies.