• Thanks for great plugin,
    it is possible to change placeholder digit numbers? now default is this for my country. 040 123 45 67

    second question is it possible put number limit?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Precious Omonzejele

    (@preciousomonze)

    Hello, Thanks for the appreciation!
    Unfortunately, you can’t change the custom placeholder, without hardcoding the javascript file, if you are familiar with Javascript, it will be very easy for you.
    I’ll add this to a next update??

    Secondly, I do not understand what you mean by “number limit”
    More explanation will be very useful for me.

    Thread Starter frankbaku

    (@frankbaku)

    Thanks for answer ??

    1. Okay i will wait ??

    2. number limit, i mean maximum digit input limit. For example now users can input unlimited digit on phone section. I just want to put maximum digit input limit. I found these codes but not worked for me

    // Limit Woocommerce phone field to 10 digits number
    add_action('woocommerce_checkout_process', 'my_custom_checkout_field_process');
      
    function my_custom_checkout_field_process() {
        global $woocommerce;
      
        // 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' );
        }
    Plugin Author Precious Omonzejele

    (@preciousomonze)

    Hello @frankbaku ,sorry i couldn’t get respond on time.
    1. Is on it’s way, might take longer than I expected, ??

    2. By default, once my plugin is active, number length won’t really matter, because it checks if the format is valid for the selected country,
    I don’t know if this helps you though, please let me know.

    Thread Starter frankbaku

    (@frankbaku)

    2. This is really matter ?? Okay, beginning of number is valid for selected country but number length must be limited. Now users can enter unlimited digit number. All governmental websites works with limited digit numbers.
    For example: now can i enter my number to +99455555555555555555555555555555555555…
    But it must be maximum to +994555555555.
    I want to use these numbers for sending orders details with sms gateways. If numbers is wrong how can i send? ??

    First of all, the plugin is awesome! Thank you!

    I have the same question as Frankbaku (2)

    For Ukraine somehow there is no validation of phone number. So user can enter any quantity of digits and the system will allow it.

    Is there any way I could limit the digits that are entered by the user?

    Plugin Author Precious Omonzejele

    (@preciousomonze)

    wow!
    thanks @furfa and @frankbaku !
    Now i’m thinking,maybe i also remember this when trying to validate a nigerian number, was some time ago, so i forgot.

    I’ve been having a tough time on my end, but i assure you i do have it in mind, in my new version release.
    I’ll try to offer up a quick solution, if possible ??.
    Again, i cant assure you of the exact time cause of how things are.
    Please sorry for the delay.

    I guess i Have found the solution for q2

    In functions php of your child theme just add the following code

    // Custom validation for Billing Phone checkout field
    add_action(‘woocommerce_checkout_process’, ‘custom_validate_billing_phone’);
    function custom_validate_billing_phone() {
    $is_correct = preg_match(‘/^[0-9]{10}$/’, $_POST[‘billing_phone’]);
    if ( $_POST[‘billing_phone’] && !$is_correct) {
    wc_add_notice( __( ‘The Phone field should be 10 digits.’ ), ‘error’ );
    }
    }

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Change placeholder digits and put number limit’ is closed to new replies.