'Phone number length issue Wordpress
Hello I'm trying to increase phone number
<span class="woocommerce-input-wrapper"><input type="tel" class="input-text " name="billing_phone" id="billing_phone" placeholder="" value="050943587" minlength="9" maxlength="9" autocomplete="tel"></span>
as showing here it's 9 and I want to increase it to 11 I don't know how to write filter and where to add it
you can see it in my checkout page here: https://raaia.com
Solution 1:[1]
You need to use the woocommerce_checkout_fields hook. You'll receive ALL checkout fields and you can alter the HTML attributes by changing the array's key like this:
// Hook your function
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Alter shipping phone values
function custom_override_checkout_fields( $fields ) {
$fields['billing']['billing_phone']['minlength'] = 9;
$fields['billing']['billing_phone']['maxlength'] = 11;
return $fields;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Skatox |
