=== Moradas — Portuguese Address Autocomplete for WooCommerce ===
Contributors: moradasdev
Tags: woocommerce, checkout, address, postcode, portugal
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Address suggestions for Portugal in the WooCommerce checkout, with the exact CP7 postal code for the shipping label. Free, no API key.

== Description ==

Customers type their address once and pick it from a list. The street, the postal
locality and the exact seven-digit postal code (CP7) are filled in for them — the
code that the carrier needs on the label, chosen by door number.

* One line is enough: "estrada malveira da serra 920" resolves to Estrada Malveira da Serra, Aldeia de Juzo, 2750-834
* Postal codes work as input too: "1000-098" fills in the locality and the street
* Forgiving matching: accents optional (sao joao), abbreviations (av → Avenida), optional prepositions
* Larger towns are ranked first
* Free, no API key, no tracking, no account

**Both checkouts.** The plugin registers itself as a WooCommerce address
autocomplete provider, so the same suggestions appear in the Checkout Blocks
(the default checkout) and in the classic shortcode checkout. The suggestion
list itself is drawn by WooCommerce, so it follows your theme.

**Only Portugal.** Suggestions appear only when the selected country is
Portugal. Every field stays editable, and if the service is unreachable the
checkout keeps working as a plain form.

**Requirements.** WooCommerce 9.9 or newer for the Blocks checkout. On older
WooCommerce versions the plugin falls back to its own suggestion list in the
classic checkout.

== Installation ==

1. Install and activate the plugin.
2. Activation switches on WooCommerce → Settings → General → "Address autocomplete"
   if your store has never used another address provider. You can turn it off there
   at any time.
3. That is all. Suggestions are active for addresses in Portugal.

The API endpoint can be changed under WooCommerce → Settings → Advanced → Moradas,
for stores that run their own instance of the service.

== Frequently Asked Questions ==

= Is it really free? =

Yes. The service at https://moradas.dev is public and free, including commercial
use. There is no API key and no account. Contact: dev@moradas.dev

= A street has several postal codes. What happens? =

Some streets are split into several postal segments. Until the door number is
known the suggestion says so, and the postal code stays empty. As soon as the
customer adds the number to the address line, the exact CP7 is offered.

= Does it work with the Checkout Blocks? =

Yes, from WooCommerce 9.9 onwards. The plugin uses the official WooCommerce
address autocomplete provider API, which serves both the block and the classic
checkout.

= Does it change my checkout fields? =

No. It fills in the standard address, city and postcode fields. Nothing is added
to the order, and no data is stored by the plugin.

== External services ==

This plugin connects to the Moradas address API (https://moradas.dev), a free
public service run by the authors of this plugin, to turn what the customer types
into address suggestions and into the exact postal code. Without this service the
plugin has nothing to suggest.

When it is used: only on the checkout page and only when the country is Portugal,
while the customer types in the address field, and once more when a suggestion is
picked. Nothing is sent when the plugin is activated, in the WordPress admin, or
on any other page.

What is sent: the text typed in the address field (for example
"estrada malveira da serra 920") and, when a postal code has to be resolved, the
identifier of the chosen street together with the door number. No name, e-mail,
phone number, order or account data is sent. The requests go from the customer's
browser straight to the API, without cookies; like any web request, they include
the browser's IP address and user agent. The service does not store the typed
text and keeps only hourly aggregate usage counts.

Terms of use and usage limits: https://moradas.dev/docs (section "Usage")
Privacy policy: https://moradas.dev/privacy

== Screenshots ==

1. Suggestions in the Checkout Blocks: one line of input, the exact CP7 on the right.
2. The same in the classic shortcode checkout.
3. After picking a suggestion: address, locality and postal code filled in.

== Changelog ==

= 0.2.1 =
* Fix: no more "translation loading was triggered too early" notice with WP_DEBUG on.
* If WooCommerce is not active, the plugin shows a notice and stays idle.
* Admin notices appear only where they are relevant: the Plugins screen, the Dashboard
  (missing WooCommerce) and the WooCommerce settings.
* Interface text is now in English, with a Portuguese (Portugal) translation included.

= 0.2.0 =
* First public release.
* Works in both the Checkout Blocks and the classic checkout through the official
  WooCommerce address autocomplete provider API (WooCommerce 9.9+).
* Suggestions show the postal code, or ask for the door number when the street
  has more than one.
* Activation switches on the WooCommerce "Address autocomplete" setting when no
  other address provider is present; deactivation puts it back.
* Declares compatibility with HPOS and with the Cart/Checkout blocks.

== Upgrade Notice ==

= 0.2.1 =
Fixes a debug notice about translations loading too early.

= 0.2.0 =
First public release.
