Gravity Forms VAT-ID Field
Adds a dedicated **European VAT ID (USt-IdNr.) field** to Gravity Forms with robust server-side
validation: a local format and per-country length check plus an optional online verification against
the **EU VIES** service or the **German BZSt eVatR** confirmation service. The VAT ID is also offered
as a reusable **Gravity Forms Settings API field** and the add-on ships a shared, extensible
**”e-Invoicing Fields”** settings page.
Features
- **VAT ID form field** — drag-and-drop field in the form editor (group *e-Invoicing Fields*).
- **Local validation** — structure check, EU country prefix and per-country length (incl. the VATspecials `EL` Greece and `XI` Northern Ireland).
- **Optional country restriction** — accept only VAT IDs of one configured country.
- **Online validation (per field, optional):**
- **EU VIES** — validates any EU VAT ID via the official VIES REST API.
- **German BZSt eVatR** — confirms a *foreign* EU VAT ID against your *own German* VAT ID.
- **Never blocks on outages** — if the chosen online service is unavailable or inconclusive, the local check remains authoritative and the submission is not rejected.
- **Shared “e-Invoicing Fields” settings page** — central place for the company’s own VAT ID; designed
to be extended by other add-ons through the `spgf_einvoice_fields_sections` filter. - **Reusable Settings API field** — a `vat_id` field type for the Gravity Forms Settings API that any
add-on can use in plugin/feed settings, with the same format validation. - **Normalized storage** — the VAT ID is stored upper-case and stripped of separators.
- **Internationalized** — English and German translations included.
- **Dependency-free** — both REST calls use the WordPress HTTP API; no Composer packages required.
Settings-Field Coding
$fields[] = array(
'name' => 'company_vat_id',
'type' => 'vat_id',
'label' => __( 'Company VAT ID', 'your-textdomain' ),
'class' => 'medium',
);