=== CeCodPostal for WooCommerce ===
Contributors: cecodpostal
Tags: woocommerce, postal code, romania, address autocomplete, checkout, cod postal
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Romanian postal code autocomplete and validation for WooCommerce checkout, powered by the CeCodPostal API.

== Description ==

CeCodPostal for WooCommerce helps customers enter a correct Romanian address at checkout. As they type a street or city, the plugin suggests real addresses from the official Romanian postal code database and fills in the postal code, city and county automatically.

**Features**

* Address autocomplete on the classic WooCommerce checkout and in My Account → Edit address.
* Fills the postal code, city and county (WooCommerce state code) automatically.
* Optional postal code hint under the field, with a clear “valid” / “not found” message.
* Optional strict validation: block checkout when the API confirms that the postal code does not exist.
* Server-side API key: the browser never sees your key. All requests go through your WordPress site.
* Caching and a per-IP rate limit keep checkout fast and protect your API quota.
* Graceful degradation: if the API is down, customers can always type the address manually.
* `[cecodpostal_finder]` shortcode for the block checkout, landing pages or any other page.
* Works with WooCommerce High-Performance Order Storage (HPOS).
* Translation-ready, with a Romanian translation included.

**Requirements**

* WordPress 6.0+
* WooCommerce 7.0+
* PHP 7.4+
* A CeCodPostal API key. The free plan includes 500 requests/month.

== Installation ==

1. Upload the plugin zip in Plugins → Add New → Upload Plugin, or copy the `cecodpostal-woocommerce` folder to `wp-content/plugins/`.
2. Activate the plugin.
3. Go to WooCommerce → CeCodPostal.
4. Paste your API key and save the settings.
5. Use “Test connection” to confirm the key and see your plan usage.

Get a free API key: https://cecodpostal.ro/register

== Frequently Asked Questions ==

= Do I need an API key? =

Yes. The plugin uses the CeCodPostal API to look up addresses and postal codes. The free plan includes 500 requests/month, enough for small stores. You can upgrade at any time.

= Is my API key exposed to customers? =

No. The key is stored in your WordPress database and used only by server-side requests. The browser talks to your own site through a nonce-protected REST endpoint.

= Does it work with the block checkout? =

The automatic autocomplete runs on the classic checkout and in My Account. For the block checkout, add the `[cecodpostal_finder]` shortcode in a Shortcode block near the checkout: customers can search an address and copy the postal code or the full address. A native block is planned.

= What happens if the API is down or the quota is reached? =

The address fields keep working normally. The plugin hides the suggestions and lets the customer type the address manually. Checkout is never blocked by a transport, authentication or quota error.

= Does it slow down checkout? =

No. Suggestions are requested only while the customer types (with a short debounce), responses are cached, and only the address fields are touched. Repeated lookups are served from the cache.

= Which countries are supported? =

Romania (RO). The address data is the official Romanian postal code database.

== External services ==

This plugin connects to the CeCodPostal API (https://cecodpostal.ro/api/v1) to look up Romanian addresses and postal codes.

* **What is sent:** the text the customer types in the address field (street, city or postal code), the requested endpoint, and your API key.
* **When:** only while the customer types in the address field, when a postal code is validated, or when the merchant uses “Test connection”.
* **What is not sent:** customer name, email, phone, cart contents or order data.
* **Service provider:** CeCodPostal. Terms: https://cecodpostal.ro/termeni-si-conditii — Privacy: https://cecodpostal.ro/politica-de-confidentialitate

== Changelog ==

= 1.0.0 =
* Initial release: address autocomplete, postal code hint and optional validation, server-side API key, caching, shortcode, Romanian translation.

== Upgrade Notice ==

= 1.0.0 =
First public release.
