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.
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.
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.
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 firstname.lastname@example.org 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.
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.
= 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.