diff --git a/includes/class-wc-countries.php b/includes/class-wc-countries.php index 385655d3626..925cc742dee 100644 --- a/includes/class-wc-countries.php +++ b/includes/class-wc-countries.php @@ -961,11 +961,12 @@ class WC_Countries { ); $address_fields['billing_phone'] = array( - 'label' => __( 'Phone', 'woocommerce' ), - 'required' => true, - 'class' => array( 'form-row-last' ), - 'clear' => true, - 'validate' => array( 'phone' ), + 'label' => __( 'Phone', 'woocommerce' ), + 'required' => true, + 'type' => 'tel', + 'class' => array( 'form-row-last' ), + 'clear' => true, + 'validate' => array( 'phone' ), ); } diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index 4a0861996df..ed23536f2d0 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -1787,6 +1787,23 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) { $field .= '
' . $after; + break; + case 'tel' : + + $field = ''; + + if ( $args['label'] ) { + $field .= ''; + } + + $field .= ''; + + if ( $args['description'] ) { + $field .= '' . esc_attr( $args['description'] ) . ''; + } + + $field .= '
' . $after; + break; case 'select' :