=== CatCode Companies House Lookup for WooCommerce ===
Contributors: catcodestudio
Tags: companies house, company number, b2b, checkout, 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 company number of a business buyer at the WooCommerce checkout against the Companies House register of the United Kingdom.

== Description ==

Adds a "Company number" field to the WooCommerce checkout (classic and block) and checks what the buyer types against the [Companies House](https://www.gov.uk/government/organisations/companies-house) register through its free Company Information API. You use your own Companies House API key.

* **Checked while the buyer types** — leaving the field shows the company name and its status ("Acme Trading Ltd — Active") or says that the number does not exist.
* **Checked again when the order is placed** — a number with a wrong format, or one that the register does not know, stops the order with a plain message. You can switch that off.
* **Kept with the order** — number, name, status and registered address 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** — the order goes through and a note says that the number was not verified; nobody is turned away because a government service is busy.
* **Quota friendly** — answers are kept for six hours, and the checkout calls go through your own server, so the API key never reaches the browser. The key is stored encrypted.
* HPOS and block checkout compatible.
// @pro-begin
* Translations included: English.
// @pro-end

// @pro-begin
= Pro =

The Pro version is sold on [catcode.com.ua](https://catcode.com.ua/modules/catcode-companies-house-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; the number is filled in.
* **Fills in the billing fields** — company name and registered office address go into empty billing fields.
* **Inactive companies refused** — dissolved companies, companies in liquidation, receivership or administration 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 is no longer active 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

Companies House is a UK government body. This plugin is an independent integration made by CatCode; it is not an official plugin of Companies House and is not affiliated with or endorsed by it. You need your own free Companies House API key.

== External services ==

The plugin connects to the Companies House Company Information API ([developer-specs.company-information.service.gov.uk](https://developer-specs.company-information.service.gov.uk/)) at `api.company-information.service.gov.uk`, and only after you save an API key.

* 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 company number, and your API key as the HTTP Basic user name. The request comes from your server; the buyer's browser never sees the key and the buyer's personal data is not sent.
// @pro-begin
* When the buyer types a company name (Pro): the typed text, to search the register.
// @pro-end

[Companies House personal information charter](https://www.gov.uk/government/organisations/companies-house/about/personal-information-charter)

== Installation ==

1. Upload the plugin and activate it. WooCommerce must be active.
2. Create an application of the type "API key" in the [Companies House Developer Hub](https://developer.company-information.service.gov.uk/manage-applications) and copy its key.
3. WooCommerce → **Companies House**: paste the key, press "Check connection", save.
4. Open the checkout: the "Company number" field is there. Try a real number, for example 00000006.

== Frequently Asked Questions ==

= Do I need a Companies House account? =

Yes, a free one: the API key belongs to you, not to us. The service allows 600 requests per five minutes for each key.

= Does it check VAT numbers? =

No. It checks that the company exists and what its status is in the Companies House register.

= Can private buyers still order? =

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

= What if the register is down? =

The order goes through, and an order note says the number was not verified.

== Changelog ==

= 1.0.0 =
* First release.
