Docs

Server-side Validation

1 min readUpdated October 19, 2026

Browser checks can be skipped, for example when JavaScript is off or an order is sent by a bot. So Smart Phone Field checks the number again on your server when the form is submitted.

What it checks#

  • The number has the right length for its country. Since version 1.2.0 this is stricter for numbers with a country code, so short local numbers (such as 7 digits in the US) are no longer accepted.
  • Only digits, spaces, hyphens and parentheses, with an optional leading plus.

If the number fails, checkout stops and the customer sees a message.

Where it runs#

  • Classic checkout
  • Block Checkout
  • My Account address pages
  • Supported form plugins and the
    shortcode

On WooCommerce 11 and newer, the check runs inside WooCommerce’s own phone validation.

It only runs when Check phone numbers is on in WooCommerce > Smart Phone Field > General.

In code#

Change the result with the nahnu_spf_phone_is_valid filter. It receives the result, the submitted number and the country code (may be empty).

add_filter( ‘nahnu_spf_phone_is_valid’, function ( $valid, $value, $country ) { return $valid; }, 10, 3 );

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only