=== Grundfast Address Field ===
Contributors: grundfast
Tags: woocommerce, checkout, address autocomplete, denmark, dawa
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Danish address autocomplete for the WooCommerce checkout, from the official Danish address register, with floor and door.

== Description ==

The customer starts typing their address and picks it from a list. When the building has several flats, they pick floor and door next. Postcode and city are filled in for them, so the order gets an address that exists.

* Works in the classic checkout and in the Checkout block.
* Billing address, shipping address and My account → Addresses.
* Only looks up addresses when the country is Denmark.
* No server proxy: the field calls Grundfast straight from the browser with a public key that only works from your shop's domains.
* Danish translation included.

The suggestions come from DAR, the official Danish address register, served by the Grundfast API. Grundfast is a paid service with a free plan; every lookup counts as one call on your Grundfast account. See https://grundfast.dk/priser.

*Dansk:* Adresse-autocomplete i WooCommerce-checkout fra det officielle danske adresseregister, med etage og dør. Postnummer og by udfyldes automatisk. Pluginet er oversat til dansk.

== External services ==

This plugin connects to the Grundfast API (https://api.grundfast.dk), run by Grundfast, to suggest Danish addresses. It is needed for the plugin to work at all.

* **When:** only on the WooCommerce checkout page and on My account → Addresses, only when a public key is saved in the settings, and only while the customer types in an address field whose country is Denmark (or has no country field).
* **What is sent:** the text the customer has typed in the address field, the public key from the settings, and — when the customer picks a house with several flats — the id of that address, to list its floors and doors. As with any request from a browser, the visitor's IP address, the browser's user agent and the shop's domain (the Origin header) reach the API. Nothing else from the order or the customer is sent.
* **Terms of service:** https://grundfast.dk/handelsbetingelser
* **Privacy policy:** https://grundfast.dk/privatlivspolitik

The address field's JavaScript ships inside the plugin (assets/grundfast-adresse.js, unminified). No code is loaded from another server.

== Installation ==

1. Create a free account at https://grundfast.dk and open Keys in the dashboard.
2. Create a public key (gf_pub_live_…) and add your shop's domains to it, e.g. shop.dk and www.shop.dk.
3. Install the plugin (Plugins → Add New → search, or Upload Plugin) and activate it.
4. Paste the key under Settings → Grundfast address field and save.

Never use a secret key (gf_live_/gf_test_) here: everything on a web page can be read by its visitors. The plugin refuses one.

== Frequently Asked Questions ==

= Do the lookups count towards my usage? =

Yes. Every list of suggestions the field fetches is one call on your Grundfast account, exactly as with a secret key. Calls refused by the API (wrong domain, over the limit) do not count.

= Can others use my public key? =

Other websites cannot use it from their visitors' browsers: it only works from the domains you added. A script outside a browser can fake your domain, but the key only opens address lookups, and each IP address has its own per-minute limit. If you suspect misuse, create a new key and revoke the old one.

= My theme uses other field names =

Add them under Other fields: the address field's CSS selector and, optionally, the postcode and city fields', separated by |.

= Does it work outside Denmark? =

No. The address register covers Danish addresses only. When the checkout's country is not Denmark, the field is left alone.

== Changelog ==

= 1.1.0 =
* The address field's JavaScript now ships inside the plugin instead of being loaded from grundfast.dk.
* English base strings with a Danish translation; readme lists the external service, its terms and privacy policy.
* Declares WooCommerce as a required plugin.

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.1.0 =
The address field's code now ships with the plugin; no settings change needed.
