Home Forums WoodMart support forum add validation code for phone number in checkout page

add validation code for phone number in checkout page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #235909

    Galzzaa
    Participant

    Hello, before im making changes, can you tell me please if this code is good and where to put it ?

    add_filter(‘woocommerce_process_registration_errors’,’custom_validate_billing_phone’,10, 4 )
    add_action( “woocommerce_after_save_address_validation”,’custom_validate_billing_phone’,1,2);
    add_action(‘woocommerce_checkout_process’, ‘custom_validate_billing_phone’);
    function custom_validate_billing_phone() {
    $is_correct = preg_match(‘/^05[0-9]{8}$/’, $_POST[‘billing_phone’]);
    if ( $_POST[‘billing_phone’] && !$is_correct) {
    wc_add_notice( __( ‘The Phone field should be start 05 and 10 digits.’ ), ‘error’ );
    }
    }

    #235946

    Hello,

    Please find a plugin or developer who would help you to get what you need. Our support does not cover the customization of Woocommerce.

    Best Regards

    #235969

    Galzzaa
    Participant

    Ok. Thank you

    #236024

    Hello,

    If you have any questions please feel free to contact us.

    Best Regards

Viewing 4 posts - 1 through 4 (of 4 total)