International Telephone Box

Documentation

WooCommerce phone validation setup

Set up phone validation on WooCommerce checkout, the Checkout block and My Account, make the phone field required and store numbers in E.164.

Last updated

View as Markdown

International Telephone Box validates phone numbers on WooCommerce checkout, in the browser and again on the server, and saves every number in E.164. It works on the classic checkout, the Checkout block and My Account. WooCommerce is optional; it was tested up to version 11.3.

Classic checkout

The billing phone field gets flags, dial codes and validation as soon as the plugin is active. An invalid number shows a clear message and the order doesn't go through.

Checkout block

Yes, it works with the Checkout block. The number is synced to the Checkout block, an invalid number shows the block's own error under the field, and the order is validated again on the server before payment. Checkout block server validation needs WooCommerce 9.9+.

My Account → Addresses

Customers editing their billing (or shipping) address in My Account get the same field and the same checks.

Server validation

Every number is checked again on the server with libphonenumber, Google's phone number data. An invalid number, or one from a country you don't offer, stops the order with a clear message. Needs PHP 8.1+; older PHP keeps browser validation. The server understands numbers that start with 00 and numbers typed with Arabic-Indic digits.

E.164 on every order

Orders and customers store the number in one format, E.164, like +201012345678. It's ready for delivery companies, SMS and WhatsApp, with no clean-up.

Follows the billing country

While the phone field is empty, its country follows the billing country the customer picks, so the right dial code is already there. (Match the phone country to the billing country.)

The WooCommerce section in settings

Phone Box → Countries has a WooCommerce section where you can turn each of these off:

  • Validate phone numbers at checkout
  • Match the phone country to the billing country
  • Also apply to the shipping phone

Make the phone field required

WooCommerce decides whether the phone field is required; the plugin doesn't force it. Set it in one place:

Checkout block: edit the Checkout page, select the Checkout block, set Phone to Required.

Classic checkout: go to Appearance → Customize → WooCommerce → Checkout, and set the phone field to Required.