add_filter( 'woocommerce_checkout_fields', 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
$fields['billing']['billing_phone']['maxlength'] = 10;
// Limit Woocommerce phone field to 10 digits number
add_action('woocommerce_checkout_process', 'my_custom_checkout_field_process');
function my_custom_checkout_field_process() {
// 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' );