• Resolved shwetaarya

    (@shwetaarya)


    Hello Team,
    I am using your plugin. It has phone number validation, but the issue is that even when a number with 11 digits or fewer is entered, the form still gets submitted without any code. I want this field to be mandatory — the form should not proceed without a proper 10-digit number and the code.
    it very, very Important
    Best

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

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

    Happy to help!

    The Phone field validation in CheckoutWC Lite is a basic validation checking if the field is empty or not empty. This is the reason why the behavior you are experiencing is expected.

    Yet, with a JavaScript snippet like this you can set the minlength attribute of the shipping_phone field to a value of 11.

    document.getElementById('shipping_phone').setAttribute('minlength','5');

    Alternatively, in the pro version of CheckoutWC, there is a feature called International Phone Field which extends the regular Phone field with more advanced features and validation. Feel free to check it here for more information: https://www.checkoutwc.com/documentation/international-phone-field/.

    Please let me know if you have any other questions.

    Best,
    Juan

    Thread Starter shwetaarya

    (@shwetaarya)

    This code is not working on my side. When I enter 5 numbers, it doesn’t show any error.

    Hello there,

    Thank you for staying in touch.

    Can you please show me with a screenshot how you are adding the code to your site?

    Best,
    Juan

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Phone Number validation’ is closed to new replies.