=== RadarAddress – Checkout Address Autocomplete for WooCommerce ===
Contributors: radarwave
Tags: woocommerce, checkout, autocomplete, address autocomplete, address validation
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 8.1
WC requires at least: 8.3
WC tested up to: 11.1
Stable tag: 1.5.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Fewer parcels sent back: customers pick their real address at checkout, and wrong addresses are flagged before you ship. Never blocks an order.

== Description ==

A parcel that comes back because of a wrong street, a missing house number or the wrong postcode costs you the shipping twice and a customer who waits. RadarAddress catches the mistake at checkout, while the customer is typing, and flags the orders whose address still does not check out, before you ship.

RadarAddress completes and corrects the customer's address while they type it at checkout — billing and shipping, classic checkout and Checkout Block — in the countries where the national address register is in service (Italy, Germany, France, Spain, the Netherlands, Belgium, Austria, Switzerland, Denmark, Norway, Finland, Iceland, Portugal and more). The postcode and the house number come from the register at the moment of selection; the customer can always change what they wrote. Nothing ever blocks the order.

Every new order is checked on the server: outcome and verified form are saved next to the order, the order list shows a colour dot (verified, warning, to review, not verified) with a filter, and the order screen shows the verified address with one button to apply it. The order address is never changed by itself.

**What you get**

* Address autocomplete on billing and shipping, classic checkout and Checkout Block.
* Email check at checkout: a mistyped address gets «Did you mean …?» under the field, with one click to accept; a mailbox that cannot receive mail gets a discreet notice. The customer's email is never changed by itself.
* Phone at checkout: an international prefix menu next to the phone field, set to the country of the address, and a short reminder under an empty phone field. The customer's number is never rewritten: the order receives it with the prefix chosen in the menu.
* Correction on the field of an address typed by hand (postcode, city, street) — optional.
* Verification of every order, with the verified address, coordinates and the reason, and the result of the email and phone checks next to it (an order without a phone number is flagged: the courier needs it if there is a problem with the delivery).
* «To review» flag, filter and bulk action in the order list.
* Verification of existing orders that you choose: which statuses, from which date, newest or oldest first, all of them, only the first ones, or a few at a time every month with a subscription.
* Verification precision from strict to maximum: how far RadarAddress goes to find an address written badly.
* Fail-open by design: if RadarAddress does not answer, the checkout goes on as usual.
* Data stays in the EU. Sources: the national address registers, published as open data.

**How it works**

1. Create a free account on radaraddress.com (every month 50 contact checks are free).
2. Create an API token in your personal area.
3. Paste it in WooCommerce → Settings → RadarAddress and press «Verify and save».

Typing is free. One contact check is used when the customer selects an address, or when an order is verified — one per address, never twice for the same one. For a small shop the 50 free checks a month are often all it needs; beyond that, packs and monthly subscriptions on radaraddress.com.

**Third-party service**

This plugin sends the address and the email typed at checkout and the order addresses, email and phone number to the RadarAddress API (https://www.radaraddress.com) to get suggestions and verification results. Terms: https://www.radaraddress.com/en/terms — Privacy: https://www.radaraddress.com/en/privacy-policy.php

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install the zip from Plugins → Add New → Upload.
2. Activate it. WooCommerce 8.3 or later is required.
3. WooCommerce → Settings → RadarAddress: paste your API token and press «Verify and save».

== Frequently Asked Questions ==

= Does it block the order when the address is wrong? =

Never. The customer can go on with what they wrote; the order is created and, if the address does not check out, it is flagged «to review» for you.

= Which countries? =

Those where the national address register is in service: the list is in the settings and grows as registers are added. Elsewhere the address is put in the postal form of the country, without suggestions.

= Does it change the order address by itself? =

No. The verified form is shown next to the order address; you apply it with one click, and an order note records before and after.

= How much does it cost? =

The plugin is free and so is typing. One contact check is counted when the customer selects an address or when an order is verified, only one per address. Every month the first 50 are free: for a small shop that is often all it needs. Beyond that, packs and monthly subscriptions on radaraddress.com.

= What if RadarAddress is down? =

The checkout goes on as usual, with no suggestions and no message to the customer; the order is marked «not verified» and checked again by a background task.

== External services ==

This plugin connects to the RadarAddress API, a service run by RadarWave (the author of this plugin), to suggest and verify postal addresses. It does nothing until you paste your own API token in WooCommerce > Settings > RadarAddress.

* **What is sent and when:** while a customer types an address at checkout, the text typed in the address fields (street, house number, postcode, city, country) is sent to the API to get suggestions; when the customer leaves the email field at checkout, and when an order is verified, the email address is sent to the API to check it (you can switch this off with «Verify the email» in the settings); when an order is placed, or when you verify existing orders from the admin, the order's billing and shipping address (name, company, street, postcode, city, province, country), billing email and phone number (with the country of the address) are sent to be verified (you can switch the phone check off with «Verify the phone number of every order» in the settings). The phone prefix menu at checkout sends nothing: it is a table inside the plugin. Your API token is sent with every request to identify your account. With each request the plugin also sends the address of the checkout page (without its query string) and which form and part it comes from (for example checkout/billing), so the request can be found in your service log. The settings page also asks the API for your account's remaining verifications.
* **Where:** https://www.radaraddress.com/api/v1/ (calls are made by your site's server, or through the plugin's own REST endpoint on your site: the token never reaches the browser).
* **Terms of use:** https://www.radaraddress.com/en/terms
* **Privacy policy:** https://www.radaraddress.com/en/privacy-policy

== Screenshots ==

1. The checkout: the street completes while the customer types, with the register source at the bottom of the popup.
2. The order page: outcome, reason, verified address, map and the button to apply it.
3. The settings: token, switches, countries, this month's usage, existing orders.

== Changelog ==

= 1.5.0 =
* When the plugin verifies the address of an order, the email and the phone number go with it in one request: the contact verification includes them, so they no longer use light checks of your account. An address picked from the suggestions is already verified: there the email and the phone keep their own check.

= 1.4.0 =
* Phone check. Every order with a phone number is checked: valid, to check or invalid, with the number in international form in the order box; an invalid number or a missing one marks the order «Warning» and writes an order note, because the courier needs the number if there is a problem with the delivery. An order without a phone number is flagged without calling RadarAddress. The phone number of the order is never rewritten and nothing blocks the order. Each phone check uses one light check of your account; the bulk action and the verification of existing orders send the numbers in one request.
* At checkout, classic and Checkout Block: an international prefix menu next to the billing and shipping phone fields, set to the country of the address and then to the country of the store. The field keeps the number as the customer writes it; the order receives it with the prefix in front (a number already written with + or 00 stays as it is). Under an empty phone field, a short reminder that does not block the order.
* New settings: «Verify the phone number of every order» and «Phone prefix menu next to the phone number field» (both on by default).
* Checkout Block: the data the plugin adds to the order (the address picked from the suggestions, the phone prefix) is registered again with recent WooCommerce versions, which load the plugin after the Checkout Block is ready; before, the order verified the picked address a second time.

= 1.3.1 =
* The same email sent again is kept as written: no second question.

= 1.3.0 =
* Email check. At checkout, when the customer leaves the email field, a mistyped address gets «Did you mean …?» under the field with one click to accept it (typo of a known provider, near-miss of a real domain, domain that does not exist); a mailbox that cannot receive mail or is disposable gets a discreet notice. The email is never changed by itself and nothing blocks the order. Whoever writes the same address a third time within an hour is left alone.
* The order check also verifies the billing email: the result sits in the order box next to the address (with the proposal, never applied) and a typo or a mailbox that cannot receive mail marks the order «Warning».
* New settings: «Verify the email» (on by default) and «Typo correction» 1-3 (3 by default). Each email check uses one light check of your account.

= 1.2.9 =
* The help under the API token says where to redeem a prepaid code: Enter a code, in your RadarAddress account.

= 1.2.8 =
* Copyright notice in every file.
* "plugin", "add-on" and the WordPress menu labels written as WordPress translates them, in every language.

= 1.2.7 =
* Each verification tells the service which form and page it came from (checkout billing or shipping, order, bulk action, backfill), with the X-RadarAddress-Form-Page and X-RadarAddress-Form headers, so it shows up in the service log. The page is sent without its query string.

= 1.2.6 =
* The rate-limit transients use the plugin prefix.

= 1.2.5 =
* The plugin homepage link points to the English page of the plugin on radaraddress.com.

= 1.2.4 =
* The account settings work as in the other RadarAddress plugins: the saved token is never shown in the page (only its last four characters), «Verify and save», the «Add a pack» button and the version next to the token.

= 1.2.3 =
* Uninstalling also removes the «Service» setting.

= 1.2.2 =
* The account is no longer created from the plugin settings (it was in 1.2.0): the token is pasted, as before.
* A «Service» menu above the token (today RadarAddress only).

= 1.1.1 =
* «Use the verified address» now also corrects the shipping address when it is the same as the billing one: before, only the billing address changed and the parcel kept the wrong postcode.
* The order box reloads when RadarAddress has answered, not after a fixed wait: a slow answer showed the old result.
* A verification of existing orders stopped with «Stop» says «Stopped», not «Finished».
* The number fields of the existing-orders panel are short again (WooCommerce made them 400 pixels wide and out of line).
* The section title in the order box starts with a capital letter in every alphabet (Greek too).
* The address suggestions show the number of municipalities as «label: number».
* Each background step of the verification of existing orders stops after 20 seconds and leaves the rest to the next one, so a slow answer cannot exceed the server's time limit when the page drives the verification.

= 1.1.0 =
* Verification precision in the settings (1 strict … 5 maximum, 3 by default), used for every order check.
* Existing orders: choose which ones (statuses, placed from a date, skipping those that already have a result), in which order (newest or oldest first) and how many (all, only the first ones, or a few at a time every month, for accounts with a subscription to contact checks). When the credit does not cover them all, the plugin proposes the part it covers or a pack.
* The verification of existing orders is followed on the page until it ends, with a report by outcome; a missed answer no longer clears the report.
* Counts written as «label: number», right with any number in every language. The installed version is shown in the settings.

= 1.0.3 =
* Code prefixes and translations reorganised following the WordPress.org review; the plugin no longer checks for new versions on radaraddress.com (updates come from WordPress.org).

= 1.0.2 =
* If the site keys change (for example after moving the site), the saved token is no longer read as random characters: it is treated as missing and the settings ask for it again.

= 1.0.1 =
* The settings now say how to get a token: a link to the getting started page, where the free account, the email confirmation and the token are explained in four steps. Fixes the link that opened the sign-in form instead of the sign-up form.

= 1.0.0 =
* First release: autocomplete and verification at checkout (classic and block), order verification, order list flag and filter, bulk action, existing orders, settings with token, countries and usage.
