Location Detection
When a visitor hasn’t chosen a country yet, Smart Phone Field finds their country from their IP address and starts the phone field on it. It can also fill an empty State / County field. Customers can always pick a different flag.
Set it up in WooCommerce > Smart Phone Field > Location.

Detection methods#
| Method | How it works | Good for |
|---|---|---|
| WooCommerce geolocation (default) | Uses WooCommerce’s built-in lookup | Most stores. No extra account. |
| CDN or hosting headers | Reads the country header your CDN or host adds (Cloudflare, Bunny, CloudFront, Vercel, CDN77, Sucuri, server GeoIP) | Sites behind a CDN. Fast, with no outside call. |
| freeipapi.com | Asks the freeipapi.com service | Free plan: 60 lookups a minute. Paid plan with an API key or whitelisted server. |
| IP2Location.io | Asks the IP2Location.io service | Without a key: 1,000 lookups a day. A free key: 50,000 a month. |
Without WooCommerce, the WooCommerce geolocation option uses your CDN or hosting headers instead.
Backup API#
With WooCommerce geolocation or CDN headers, you can choose freeipapi.com or IP2Location.io as a backup. It’s only asked when the first method finds no country, or no state when Pre-fill state is on.
Pre-fill state#
Also fills an empty billing or shipping State / County when the visitor’s country matches the selected one. IP2Location.io returns state codes only on a Plus plan. Otherwise the plugin matches the state by name.
Use for WooCommerce geolocation#
Lets WooCommerce use the same method for its own lookups: the checkout country and state pre-fill, and shipping and tax estimates. It only takes effect when WooCommerce > Settings > General > Default customer location is set to a Geolocate option.
Speed and caching#
- The lookup runs separately from the page, so it works with page caching.
- The lookup starts while the page is still loading.
- If it takes longer than 2 seconds, the field starts on your store’s country (or your site language’s country) instead.
- The result is remembered for one day, on your server and in the visitor’s browser, so repeat visits show the flag straight away. Only the country and state are kept.
- API lookups are limited per visitor and site-wide, so nobody can use up a paid quota.
When no country is found#
The field starts on your store’s country. Without WooCommerce, it starts on your site language’s country (for example, English (United States) gives the US flag).
Behind a CDN or proxy? See CDN Proxy and Visitor IP.