Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.41k stars 1.99k forks source link

Improve checkout phone number validation error #55107

Open sirbrillig opened 3 years ago

sirbrillig commented 3 years ago

If country code validation for a phone number fails during checkout (in general you only see the phone number field if your purchase contains a domain registration), the error message reads Enter a valid country code followed by a dot (for example +1.6285550199).. This message is confusing because the error message is referring to the final phone number format, but the phone number field is intelligent and usually will not show the formatted phone number. A better message might be something like That country code was not recognized.

The error message comes from the server in the validation endpoint, so this could possibly be fixed there or could be transformed when it's displayed by the frontend.

Another question is how getting this error message is possible. We've had reports of it occurring, but in theory the autoformatting of the phone number field should make this impossible since the country code is set by the drop-down.

sirbrillig commented 3 years ago

See original report here pNPgK-5wc-p2