=== VIESAC – Free VAT Validation for WooCommerce ===

Contributors: viesac
Tags: woocommerce, vat, vies, b2b, tax
Requires at least: 5.9
Tested up to: 7.1
Stable tag: 1.0.14
Requires PHP: 7.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

VAT validation for WooCommerce checkout with monthly live-check limits, B2B tax handling, and stored VIESAC proof for eligible orders.

== Description ==

VIESAC adds country-specific VAT validation to WooCommerce checkout. It checks VAT number formats locally for EU countries, Norway, and Switzerland, validates VAT numbers live through the VIESAC API when an API key is configured, and stores VIESAC certificates for audit-ready B2B orders.

= Features =

* **Country-specific format checks** - Validate VAT number formats locally without an API key
* **Live VAT validation** - Validate VAT numbers through VIESAC before applying 0% VAT
* **Clear plan usage** - See monthly VAT checks, hourly live-check capacity, and stored-proof usage separately
* **Stored proof allowance** - Full audit records and VIES certificates use a separate plan allowance
* **Status without proof** - When the stored-proof allowance is exhausted, orders keep their VALID/INVALID status and clearly show that no proof was stored
* **Lifetime storage** - VIES certificates stored permanently
* **EU VIES compliance** - VAT number validation for EU businesses
* **B2B tax exemption** - Automatic WooCommerce tax removal only after live VAT validation succeeds
* **Certificate download** - PDF certificate available in order details
* **Company and VAT fields** - Adds company name and VAT number fields to checkout
* **Checkout blocks support** - Works with WooCommerce Blocks
* **HPOS compatible** - Compatible with WooCommerce Custom Order Tables
* **Multilingual compatible** - Works with WPML, Polylang, TranslatePress, and standard WordPress language packs

= Supported countries =

All EU member states plus Norway (NO) and Switzerland (CH).

= Getting started =

1. Install and activate the plugin.
2. Go to WooCommerce -> VIESAC.
3. Get your free API key from [https://viesac.eu/app/api](https://viesac.eu/app/api).
4. Enter the API key and save.

= Languages =

VIESAC is available in 25+ languages: English, Norwegian Bokmål, German, French, Spanish, Italian, Polish, Dutch, Romanian, Greek, Czech, Swedish, Hungarian, Portuguese, Bulgarian, Danish, Finnish, Slovak, Croatian, Latvian, Estonian, Lithuanian, Slovenian, Russian, Turkish, Arabic, Ukrainian.

= Multilingual compatibility =

VIESAC uses standard WordPress gettext for its interface and VAT validation messages, so it works with WordPress language packs and the Gettext translation tools in WPML, Polylang, and TranslatePress.

Custom **VAT field label** and **VAT field placeholder** values are supported too:

* WPML: translate them in **WPML -> String Translation** after saving the VIESAC settings.
* Polylang: translate them in **Languages -> String translations** after saving the VIESAC settings.
* TranslatePress: translate them as regular strings in its translation editor after visiting checkout in the target language.

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/viesac/`, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the `Plugins` screen in WordPress.
3. Ensure WooCommerce is installed and active.
4. Go to WooCommerce -> VIESAC and enter your API key from [https://viesac.eu/app/api](https://viesac.eu/app/api).

== Frequently Asked Questions ==

= Do I need to pay? =

Local VAT format validation is unlimited and works without an API key. Live VAT validation and stored audit proof follow your VIESAC plan:

* Free: 100 live VAT validations per month (10/hour) and 5 stored audits total
* Starter: 1,000 live VAT validations per month (100/hour) and 100 stored audits per month
* Pro: 10,000 live VAT validations per month (500/hour) and 500 stored audits per month
* Business: 30,000 live VAT validations per month (1,000/hour) and 3,000 stored audits per month
* Enterprise: custom/unlimited validation and audit capacity

= What is an audit? =

An audit is a full validation record that stores technical proof and makes the certificate available for the order. Checkout format checks are unlimited; live VAT validation uses monthly and hourly limits, while stored proof uses a separate audit allowance.

= What happens when my stored-proof allowance is exhausted? =

Checkout still performs live VAT validation while validation capacity is available. The WooCommerce order keeps the VALID or INVALID status, shows “No proof stored,” and displays an upgrade notice. No audit record or certificate is stored for that order.

= What happens with LIMITED VALID and PENDING? =

These statuses can be returned when a full audit is created and VIES is temporarily unavailable. WooCommerce stores the audit reference and displays LIMITED VALID or PENDING without a certificate; VIESAC retries the saved audit automatically. When the audit allowance is already exhausted, no audit exists to retry, so the plugin records only the available live VALID/INVALID result and clearly marks it as “No proof stored.”

= Does it work with WooCommerce Blocks? =

Yes. VIESAC is compatible with WooCommerce Blocks checkout.

== External services ==

This plugin connects to the VIESAC API to validate VAT numbers, retrieve account usage information, and optionally create audit records with certificate storage.

It sends data to `https://viesac.eu` only when a store administrator enters an API key and the plugin performs one of these actions:

* Live VAT validation via `https://viesac.eu/api/v1/validate`
* VAT audit creation via `https://viesac.eu/api/v1/audits`
* Account and usage lookup via `https://viesac.eu/api/v1/account`

Depending on the action, the plugin may send:

* VAT country code and VAT number
* Company name
* Company address
* Order number
* Order audit details in XML format for certificate generation

Service provider documentation:

* Privacy Policy: [https://viesac.eu/privacy-policy](https://viesac.eu/privacy-policy)
* Terms of Service: [https://viesac.eu/terms-of-service](https://viesac.eu/terms-of-service)

== Screenshots ==

1. WooCommerce order page with verified VAT status and VIESAC certificate download button
2. VIESAC configuration page for API key and audit usage
3. WooCommerce checkout with company name, VAT number, and tax-exempt B2B total

== Changelog ==

= 1.0.14 =

* Add monthly VAT validation usage and capacity to the settings table
* Separate monthly validation, hourly validation, and stored audit proof into clear usage rows
* Preserve VALID/INVALID order status when the audit/certificate allowance is exhausted
* Display saved LIMITED VALID and PENDING audits as amber states without a certificate
* Show “No proof stored” and a translated upgrade notice on affected orders
* Update plan limits and plugin descriptions for the new VIESAC allowances

= 1.0.13 =

* Keep VAT in the total until a separate shipping country is selected

= 1.0.12 =

* Ignore stale shipping fields when Ship to a different address is unchecked

= 1.0.11 =

* Keep VAT in the total when a valid foreign VAT number is paired with delivery to the store's base country

= 1.0.10 =

* Add editable VAT field label and placeholder in WooCommerce -> VIESAC settings
* Apply configured VAT field text to Classic Checkout, Checkout Block, and My Account address forms
* Register custom field text with WPML String Translation and Polylang String translations
* Add Norwegian Bokmål translation

= 1.0.9 =

* Pre-fill VAT numbers saved in My Account billing and shipping profiles in Classic and Block Checkout
* Synchronize VAT values between Classic profile meta and Block Checkout address fields
* Respect an explicitly cleared optional VAT number instead of restoring an older saved value

= 1.0.8 =

* Block checkout submission when a non-empty VAT number has an invalid format or VIESAC confirms it is invalid
* Show the validation error in the standard WooCommerce notice area for classic checkout and as a Store API error for Block Checkout
* Keep VAT optional: customers can remove a VAT number and complete checkout with regular VAT

= 1.0.7 =

* Redesign the VIESAC settings account summary to separate live VAT validation limits from monthly audit/certificate usage
* Show a checkout success state when VIESAC live VAT validation succeeds
* Show a dedicated country mismatch error when the VAT number prefix does not match the selected checkout country
* Improve WooCommerce-origin VAT checker logs in the VIESAC app
* Tested with WordPress 7.0 and WooCommerce 10.9.4

= 1.0.6 =

* Show live VAT validation usage for the current hour on the VIESAC settings page
* Fix billing/shipping country matching for VAT format checks in classic and block checkout

= 1.0.5 =

* Require complete B2B checkout fields and live VIESAC API validation before applying 0% VAT
* Add country-specific VAT format validation for EU countries, Norway, and Switzerland
* Show inline VAT errors for invalid formats, invalid VAT numbers, and hourly validation limits
* Show format-only mode and live validation hourly limits on the VIESAC settings page

= 1.0.4 =

* Add Norway and Switzerland VAT validation support
* Add WordPress.org plugin icons, banner, and screenshots
* Sharpen readme copy around free VAT validation, VAT number checkout fields, B2B tax exemption, and certificate storage

= 1.0.3 =

* Clean up WordPress.org scanner issues without changing checkout behavior
* Add missing plugin translations for Company name fields across all bundled locales
* Rebuild translation files for verified runtime loading in WordPress
* Harden admin output escaping and checkout/order input sanitization
* Normalize plugin file line endings and refine PHPCS-safe request handling in checkout/order flows

= 1.0.2 =

* Add best-effort fallback VAT field injection for custom WooCommerce checkout themes
* Re-inject VAT field after checkout AJAX updates and DOM re-renders
* Improve compatibility with custom theme checkout wrappers such as Avada-style layouts
* Keep WooCommerce Blocks behavior separate from classic/custom theme fallback logic

= 1.0.1 =

* Update text domain and WordPress compatibility metadata
* Add WooCommerce dependency header
* Document external API service usage for WordPress.org review
* Clean plugin copy for UTF-8 safe packaging

= 1.0.0 =

* Initial release
* VAT validation at checkout
* Free VIESAC audit allowance
* VIES certificate download
* Admin settings page
* 25+ language translations

== Upgrade Notice ==

= 1.0.14 =

Adds monthly usage visibility and keeps the VAT status on orders even when no certificate proof can be stored because the audit allowance is exhausted.

= 1.0.13 =

VAT exemption now waits for a selected shipping country when Ship to a different address is enabled.

= 1.0.12 =

Shipping-address VAT logic now applies only while Ship to a different address is selected.

= 1.0.10 =

Configure the VAT field label and placeholder in WooCommerce -> VIESAC. Custom values can be translated through WPML String Translation, Polylang String translations, or TranslatePress.

= 1.0.9 =

Saved VAT numbers now pre-fill checkout and remain optional: removing a VAT number keeps the field empty and allows regular-VAT checkout.

= 1.0.8 =

Invalid non-empty VAT numbers now reliably stop checkout in both classic and Block Checkout. Leave the optional field empty to continue with regular VAT.

= 1.0.7 =

Separates validation and audit usage in settings, improves checkout VAT feedback, labels WooCommerce VAT checker logs correctly, and is tested with WordPress 7.0 / WooCommerce 10.9.4.

= 1.0.6 =

Shows hourly live validation usage in settings and fixes VAT format checks when billing and shipping fields differ.

= 1.0.5 =

0% VAT now requires complete B2B checkout data and successful live VIESAC validation. Format-only validation remains available without an API key.

= 1.0.4 =

Adds Norway and Switzerland VAT validation support and WordPress.org visual assets.

= 1.0.3 =

Recommended update for WordPress.org packaging cleanup, improved translation coverage, and safer metadata handling.

Adds better checkout compatibility for custom WooCommerce themes and builders.

= 1.0.1 =

WordPress.org compatibility and packaging cleanup release.
