=== CatCode SIRET Lookup for WooCommerce ===
Contributors: catcodestudio
Tags: siret, siren, sirene, b2b, woocommerce
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Checks the SIRET or SIREN number of a business buyer at the WooCommerce checkout against the French Sirene register.

== Description ==

Adds a "SIRET or SIREN number" field to the WooCommerce checkout (classic and block) and checks what the buyer types against the French company register through the open [API Recherche d'entreprises](https://recherche-entreprises.api.gouv.fr/docs) (Annuaire des Entreprises). No account and no key are needed.

* **Checked while the buyer types** — leaving the field shows the company name and its status ("ACME SAS — Active") or says that the number does not exist. The check digit (Luhn) is verified first, so typing errors are caught without a request.
* **Checked again when the order is placed** — a wrong number, or one the register does not know, stops the order with a plain message. You can switch that off.
* **Kept with the order** — number, name, status, address and the French VAT number computed from the SIREN are saved on the order, with a note, and shown in a box on the order screen.
* **Optional or required** — the field can be optional (private buyers skip it) or required for every order. The label is yours to change.
* **If the register is down or busy** — the order goes through and a note says that the number was not verified.
* **Gentle on the register** — answers are kept for twelve hours and the checkout calls go through your own server.
* HPOS and block checkout compatible.
// @pro-begin
* Translations included: English, French.
// @pro-end

// @pro-begin
= Pro =

The Pro version is sold on [catcode.com.ua](https://catcode.com.ua/modules/catcode-siret-lookup-for-woocommerce/), with a 7-day trial that never starts by itself:

* **Search by company name** — the buyer types a name and picks the company from a list; its SIRET is filled in.
* **Fills in the billing fields** — company name and the address of the establishment go into empty billing fields.
* **Ceased companies refused** — companies that the register shows as ceased (and closed establishments) cannot be used for an order.
* **Stricter or looser when the register is down** — choose whether an order is refused when the register cannot be reached.
* **Check again** — a button on the order screen asks the register again and writes the change to the order notes.
* **Check before shipping** — when an order goes to Processing the register is asked once more; if the company has ceased the order is put on hold.
* Updates from catcode.com.ua.

The licence runs for 1-5 years and includes updates and support for that term; a purchased licence keeps its Pro features after the term ends. One key covers two sites: the shop and its test copy.
// @pro-end

Sirene is the register of INSEE. This plugin is an independent integration made by CatCode; it is not an official plugin of INSEE or of the Annuaire des Entreprises and is not affiliated with or endorsed by them.

== External services ==

The plugin connects to the API Recherche d'entreprises ([recherche-entreprises.api.gouv.fr](https://recherche-entreprises.api.gouv.fr/docs), operated by the French administration, see [api.gouv.fr](https://api.gouv.fr/les-api/api-recherche-entreprises)) at `recherche-entreprises.api.gouv.fr`.

* When a buyer leaves the number field, when an order with a number is placed and when you press "Check connection" or "Look up": the SIRET or SIREN number that was typed. The request comes from your server and carries the address of your site in its User-Agent; the buyer's personal data is not sent. The service allows 7 requests per second from one address.
// @pro-begin
* When the buyer types a company name (Pro): the typed text, to search the register.
// @pro-end

== Installation ==

1. Upload the plugin and activate it. WooCommerce must be active.
2. WooCommerce → **SIRET**: press "Check connection" (no key is needed) and look at the settings.
3. Open the checkout: the "SIRET or SIREN number" field is there. Try 356 000 000 00048.

== Frequently Asked Questions ==

= Do I need an account or a key? =

No. The API is open and read-only.

= Does it check the VAT number? =

No. It checks that the company exists and is active, and shows the French VAT number that follows from the SIREN; it does not ask VIES.

= Can private buyers still order? =

Yes. Leave "Required" off and the field is optional.

== Changelog ==

= 1.0.0 =
* First release.
