=== lessthanweb VAT ID Checker ===
Contributors: lessthanweb
Tags: vat, vat id, vies, tax exemption, woocommerce
Requires at least: 6.8
Tested up to: 7.1
Requires PHP: 8.3
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Verify customer VAT IDs at checkout and in My Account with the European Commission's VIES service.

== Description ==

lessthanweb VAT ID Checker adds optional VAT country and VAT ID fields to WooCommerce Classic Checkout and Checkout Block. It checks submitted values server-side with the European Commission's VAT Information Exchange System (VIES), and lets customers update their current VAT ID in My Account.

Confirmed-invalid VAT IDs never remove tax. A confirmed-valid VAT ID can qualify for tax removal when the store's tax configuration and country rules allow it. **Keep tax for domestic VAT IDs** is enabled by default and retains normal taxes when the WooCommerce taxable country matches the store's base country; store owners can disable it when their rules require domestic VAT-ID exemptions. The VAT ID and verification result are recorded either way. When the VAT country differs from the billing country, the customer must confirm authorization before the plugin can remove tax. Store administrators choose whether checkout is allowed when VIES cannot verify a VAT ID; unverified IDs are not treated as invalid.

The plugin stores the current customer verification and order verification history through WordPress and WooCommerce APIs. Order audit details can include the submitted VAT ID, verification status and time, billing country, and (when available) the customer's IP address and its country from WooCommerce local geolocation. The plugin also provides WordPress personal-data export and erasure support and suggests privacy-policy text.

The VAT country prefix and number are sent to the European Commission's VIES service for verification. See the [VIES information](https://ec.europa.eu/taxation_customs/vies/) and its [privacy notice](https://ec.europa.eu/taxation_customs/vies/#/disclaimer). The plugin does not send customer IP addresses to VIES.

Administrators can choose whether checkout shows the company name and address returned by VIES after a valid check. These details are shown only during checkout and are not saved to customer or order records. Checkout fields can be placed in order details or the billing section; Checkout Block address fields appear in both billing and shipping sections.

Optional settings add the saved VAT ID to invoices from WooCommerce PDF Invoices & Packing Slips by WP Overnight or YITH WooCommerce PDF Invoice. Each integration is independently disabled by default, and the invoice label can be customized.

Diagnostic history is limited to 100 entries and expires after 30 days. It does not contain full VAT IDs or customer IP addresses. Customer VAT data is removed when account data is erased. Order snapshots follow the store's WooCommerce order-retention and erasure policy.

This plugin does not provide tax or legal advice, and its authors are not tax experts. Store owners are responsible for confirming their tax settings and VAT treatment with a qualified tax advisor or accountant.

This is the free edition and includes essential VAT ID verification and tax handling. Advanced features, when available, are provided separately in a Pro edition.

== Developer hooks ==

The `lessthanweb_vat_id_checker_order_verification_details_after_ip_country` action runs in the order verification details immediately after the IP country for each displayed attempt. It fires for the latest attempt and each previous attempt, which Free displays in a collapsed section. The action receives an array containing only `country_prefix`, `billing_country`, `ip_country`, and `checked_at`; it does not include the VAT number or customer IP address.

== Requirements ==

* WordPress 6.8 or later.
* PHP 8.3 or later.
* WooCommerce 8.9.0 or later.
* Tested with WooCommerce 11.2.1.

== Installation ==

1. Upload the `lessthanweb-vat-id-checker` folder to the `/wp-content/plugins/` directory, or install the plugin through the WordPress Plugins screen.
2. Activate lessthanweb VAT ID Checker and WooCommerce.
3. Open **WooCommerce > Vat ID** to choose how checkout behaves when VIES is unavailable.
4. Test the store's tax configuration with a qualified tax advisor before relying on tax removal.

== Frequently Asked Questions ==

= What happens when VIES is unavailable? =

The store administrator chooses whether checkout may continue with the VAT ID marked unverified or must wait until VIES responds. An outage is never treated as proof that an ID is invalid. Tax is retained for unverified IDs by default; the separate setting to remove tax for unverified IDs is off by default.

= Does a valid VAT ID always remove tax? =

No. Tax removal depends on the store's tax configuration and eligibility conditions. By default, a domestic customer whose WooCommerce taxable country matches the store's base country keeps normal taxes, but the **Keep tax for domestic VAT IDs** setting can be disabled if the store's rules require otherwise. For eligible cross-border destinations, a VAT-country/billing-country mismatch also requires customer authorization. A confirmed-invalid ID never removes tax.

= Which checkout types are supported? =

The plugin supports WooCommerce Classic Checkout and Checkout Block, as well as VAT ID display and updates in My Account.

= Can I change where the checkout VAT fields appear? =

Yes. The fields can appear in order details or in the billing address section. The Checkout Block API places address fields in both billing and shipping sections.

= Can I show company details returned by VIES? =

Yes. Enable the setting to show the returned company name and address after a valid check. Some member states do not return these details; they are not saved to customer or order records.

= Which invoice plugins are supported? =

The plugin has optional integrations for WooCommerce PDF Invoices & Packing Slips by WP Overnight and YITH WooCommerce PDF Invoice. Both integrations are disabled by default and use the saved VAT ID and configurable label.

= What data is sent to VIES? =

Only the submitted VAT country prefix and VAT number are sent to the European Commission VIES service for verification. The customer IP address is not sent to VIES.

= How are VAT details exported or erased? =

Current customer VAT data is included in WordPress personal-data exports and is removed by the plugin's account-data eraser. Order snapshots are handled through WooCommerce order privacy tools and follow the store's normal order-retention and erasure policy.

= Does the plugin provide tax advice? =

No. Store owners must ask a qualified tax advisor or accountant to review their tax settings and VAT treatment.

== Changelog ==

= 1.0.1 =
* Add an order verification details hook after the IP country for each attempt.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.1 =
Update to add the public order verification details hook required by Pro risk review.

= 1.0.0 =
Initial release.
