Docs

Shortcodes

2 min readUpdated October 19, 2026

Two shortcodes add the phone field anywhere on your site, with or without WooCommerce. They use the same settings as the checkout field: countries, location detection, number checking and accent color.

[smart_phone_ field]*#

Adds a phone field with the flag dropdown to any form (that you have integration with).

[smart_phone_field name="phone" label="Phone number" required="yes" country="us"]

When the form is sent, phone holds the full international number (for example +12015550123) and phone_country holds the two-letter country code. The second field is always named after the first, plus _country.

[smart_phone_field_ demo]*#

Shows a live demo that looks like the WooCommerce checkout field: a phone field plus the saved number, readable format, country, number type and whether the number is valid. It’s checked in the browser and by the server. Nothing typed into the demo is saved.

[smart_phone_field_demo]

Attributes#

Both shortcodes take the same attributes.

AttributeWhat it doesDefault
nameThe field’s name in the submitted formphone (demo: nahnu_spf_demo_phone)
idHTML id of the inputEmpty
labelLabel textPhone number
valueStarting numberEmpty
countryTwo-letter starting country, such as gbDetected location, then the store’s country
requiredyes, true or 1 to make it requiredno
placeholderPlaceholder textEmpty
classExtra CSS classesEmpty
stylewoocommerce for the WooCommerce checkout look, with the label inside the boxEmpty (demo: woocommerce)

In a theme or plugin#

Use the PHP functions instead: echo nahnu_spf_field( array( 'name' => 'phone' ) ); or echo nahnu_spf_demo();. See PHP Functions.

*Added spaces so shortcodes do not load

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