WooCommerce
				WooCommerce phone number validation
		Validate all phone numbers entered by clients on your website with a valid format to ensure client data is correct.

WooCommerce

WooCommerce phone number validation

Validate all phone numbers entered by clients on your website with a valid format to ensure client data is correct.

With WooCommerce phone number validation customers phone numbers are validated in checkout to ensure they are typed in correctly.

Also works with international phone numbers.

WooCommerce phone number validation

Validation of phone numbers in WooCommerce

You set it up under “Appearance > Customize > WooCommerce > Validation of phone number”. Here you are also able to set selectors for additional input fields which contains phone numbers and change settings for the saved format which are saved on the checkout.

WooCommerce phone number validation settings

Installation / Setup

To get started you just need to purchase the plugin and enter the license which you received upon purchase. After activating the plugin go to “Appearance > Customize > WooCommerce > Validation of phone number” to set the license and set the desired settings.

Requirements

  • WordPress Version 4.9.x or newer
  • WooCommerce Version 3.2.x or newer

 

WooCommerce phone number validation in checkout (roadmap)

We had to start somewhere! What do you think we should develop next? – Write to us at support@rommel.dk if you have any ideas or features you’d like to see in this plugin.

Customize the plugin via PHP filters

Use this code if you need to validate phone number fields on other pages than the checkout in WooCommerce. Note that ajax loaded fields are not supported.

add_filter('r_wc_validate_phone_number_enable', function() {
return true;
});

Additional fields which should be validated (could be dynamic fields)

It’s possible to add a list of fields to validate by a PHP filter which could help you validate fields added dynamically. You will need to use a filter and add custom selectors which are either classes or ids on the input field that should be validated.

add_filter('r_wc_validate_phone_number_inputSelectors', function( $selectors ) {
return array_merge($selectors, [
'.this-class-should-be-validated',
'#thisIdShouldBeValidated'
]);});

= 1.0.0 (29/05-21) =
* Added plugin.

= 1.1.0 (27/08-21) =
* Fix error where shipping phone number was attempted validated even though shipping address wasn’t in use making it
impossible to submit the checkout without filling in a valid shipping phone number.

= 1.1.1 (14/09-21) =
* Fix error where setting to remove space resulted in removing the phone number entirely.

Contact

  • This field is for validation purposes and should be left unchanged.