=== BiLLiO for WooCommerce ===
Contributors: billio
Tags: woocommerce, checkout, address autocomplete, address validation, company
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.3.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Company details from Slovak and Czech registers and Slovak and Czech address suggestions and checks at checkout.

== Description ==

Two features with one website key, each of them can be turned off:

**Company details.** Customers buying as a company type a company name or ID into the Company field and choose from suggestions. The address, company ID (IČO), tax ID (DIČ) and VAT ID (IČ DPH) are filled in automatically and saved with the order.

**Addresses.** Customers start typing the street and pick the address from suggestions, the street, city and postcode are filled in. Before the order is placed, the address is checked against the official address register (Register adries in Slovakia, RÚIAN in Czechia) and a correction is offered for typos or a wrong postcode. The result of the check is shown on the order in the admin, with a link to the map.

* Works with the block checkout and the classic checkout, address suggestions also in My account.
* Companies and sole traders from Slovakia and Czechia, all addresses of Slovakia and Czechia.
* The company ID fields appear only after a company is entered, so consumers do not see them.
* If the service is not available, customers fill in the form manually. The plugin never blocks an order.
* The suggestions run in the customer's browser, the shop's server is not involved and gets no extra load.

The plugin does not change VAT, prices or shipping.

== External services ==

The plugin connects to two BiLLiO APIs, both are required for the suggestions to work. The requests go straight from the customer's browser, together with your website key, the address of the page, the name of the form and a random session ID.

* Company search (https://api.billio.sk) searches public Slovak and Czech company registers. When a customer types at least three characters into the Company field at checkout and the billing or shipping country is one of the countries chosen in the settings (Slovakia, Czechia), the browser sends the typed text and the country code.
* Addresses (https://address.billio.sk) searches the official Slovak and Czech address registers. While the customer types into the address fields at checkout or in My account and the country is one of the countries chosen in the settings (Slovakia, Czechia), the browser sends the typed street, house number, city and postcode. When the address is complete, it is sent again to be checked.

The customer's name, email and other checkout fields are not sent. The connection test on the settings screen sends a fixed company ID and asks for the address settings of the key. The suggestion scripts are part of the plugin, nothing is loaded from other servers.

The service is provided by BiLLiO: [terms and privacy policy](https://www.billio.sk/ochrana-osobnych-udajov).

== Installation ==

1. Install and activate the plugin. WooCommerce must be active.
2. Create a free API key at https://www.billio.sk/login with the use On a website, turn on the services Company search and Addresses and allow your shop's domain.
3. Go to WooCommerce > Settings > Integration > BiLLiO, enter the key and click Test connection. It checks both services from your browser, including the allowed domain.

== Frequently Asked Questions ==

= I used version 0.1 with a server key. What do I need to do? =

Create a website key at billio.sk (use On a website, services Company search and Addresses, your shop's domain) and enter it in the settings. The server key is not used any more, you can revoke it.

= Why is the API key visible in the page source? =

The suggestions run in the customer's browser, so the browser needs the key. It is a website key: it works only on the domains you allow, and BiLLiO limits it for each visitor separately.

= The Company field was hidden in my shop. Why is it visible now? =

The search works in the Company field, so the plugin shows it as optional while company details are turned on.

= Where are the company IDs stored? =

In the order, under the keys `_wc_billing/billio/ico`, `_wc_billing/billio/dic` and `_wc_billing/billio/ic_dph`. They appear in the order in the admin, in order emails and on the customer's order page.

= Where is the result of the address check stored? =

In the order, under the keys `_billio_address_billing` and `_billio_address_shipping`: the status, the address ID in the register and GPS coordinates. It is shown under the address on the order in the admin. The result comes from the customer's browser, so treat it as a hint, the plugin never blocks or changes an order because of it.

= Why is there a BiLLiO note under the suggestions? =

The service is free. In return, the suggestions show a short note with the BiLLiO logo and a link to billio.sk.

== Changelog ==

= 0.3.2 =
* New setting Countries: choose Slovakia, Czechia or both. Suggestions run only when the customer chooses one of them at checkout, and only from the chosen country.

= 0.3.1 =
* Czech addresses: suggestions and checks when the country at checkout is Czechia (RÚIAN, ČÚZK).

= 0.3.0 =
* One website key for company details and addresses, set up in one place.
* Company search goes straight from the customer's browser, the shop's server no longer forwards it.
* The connection test checks both services and the allowed domain.
* The address suggestions use the shared BiLLiO script.

= 0.2.0 =
* Address suggestions and checks for Slovak addresses at checkout and in My account.
* The result of the address check is shown on the order in the admin.
* The BiLLiO logo under suggestions is drawn as an image, it looks the same in every theme.

= 0.1.0 =
* First version.
