=== CatCode ABN Lookup for WooCommerce ===
Contributors: catcodestudio
Tags: abn, abn lookup, australia, b2b, checkout
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

Adds an ABN field to the WooCommerce checkout and checks the number against ABN Lookup of the Australian Business Register.

== Description ==

Adds an "ABN" field to the WooCommerce checkout (classic and block) and checks what the buyer types against [ABN Lookup](https://abr.business.gov.au/), the public view of the Australian Business Register, through its free web services. You use your own authentication GUID.

* **Check digits first** — every ABN is tested with the official modulus 89 rule before anything is sent, so a typing mistake is caught at once, even before you have a GUID.
* **Checked while the buyer types** — leaving the field shows the entity name, the ABN status and the GST registration ("Acme Trading Pty Ltd — Active · registered for GST") or says that the number is not in the register.
* **Checked again when the order is placed** — an ABN with wrong check digits, or one that the register does not know, stops the order with a plain message. You can switch that off.
* **Kept with the order** — ABN, entity name, status, entity type, GST registration, state and postcode are saved on the order, with a note, and shown in a box on the order screen. The ABN is printed in the order e-mails and on the order page of the buyer.
* **My account** — a signed-in buyer finds the field under Account details, and the saved ABN is filled in at the next checkout.
* **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 ABN 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 GUID never reaches the browser. The GUID 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-abn-lookup-for-woocommerce/), with a 7-day trial that never starts by itself:

* **Search by business name** — the buyer types a name and picks the entity from a list; the ABN is filled in.
* **ACN accepted** — a nine-digit ACN typed into the field is replaced with the ABN of that company.
* **Fills in the billing fields** — entity name, state and postcode from the register go into empty billing fields.
* **Cancelled ABNs refused** — an ABN that the register shows as cancelled cannot be used for an order.
* **Active ABN needed for roles and payment methods** — for example wholesale customers, or payment on account: such an order is not placed without an active ABN.
* **Prices excluding GST for GST-registered buyers** — the catalogue and the cart show prices without GST to a signed-in buyer whose ABN is registered for GST. The tax of the order itself stays with the WooCommerce tax settings.
* **ABN on PDF invoices** — the buyer's ABN is printed under the billing address on the documents of "PDF Invoices & Packing Slips for WooCommerce".
* **Check again** and **check before shipping** — a button on the order screen asks the register again; when an order goes to Processing the register can be asked once more and the order put on hold if the ABN is no longer active.
* **Saved ABNs re-checked** — the ABNs on customer accounts are asked about again every 30 days; the administrator gets an e-mail when one is no longer active.
* **Log of checks** with a CSV export.
* **Stricter or looser when the register is down** — choose whether an order is refused when the register cannot be reached.
* 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

ABN Lookup is a service of the Australian Government. This plugin is an independent integration made by CatCode; it is not an official plugin of the Australian Business Register and is not affiliated with, endorsed or approved by the Commonwealth of Australia. You need your own free authentication GUID. The register does not warrant that its data is accurate or complete, and details of an entity may be withdrawn from it.

== External services ==

The plugin connects to the ABN Lookup web services of the Australian Business Register ([abr.business.gov.au/json](https://abr.business.gov.au/json/)) at `abr.business.gov.au`, and only after you save a GUID.

* When a buyer leaves the ABN field, when an order with an ABN is placed, when a buyer saves an ABN in My account and when you press "Check connection" or "Look up": the ABN and your GUID. The request comes from your server; the buyer's browser never sees the GUID and the buyer's personal data is not sent.
// @pro-begin
* When the buyer types a business name (Pro): the typed text, to search the register. When the buyer types an ACN (Pro): the ACN. With the scheduled re-check on (Pro): the saved ABNs of customer accounts, up to 25 a day.
// @pro-end

[ABN Lookup web services agreement](https://abr.business.gov.au/Tools/WebServicesAgreement) · [ABN Lookup privacy policies](https://abr.business.gov.au/Home/PrivacyPolicies)

== Installation ==

1. Upload the plugin and activate it. WooCommerce 8.9 or newer must be active.
2. Register for the ABN Lookup web services on [abr.business.gov.au/Tools/WebServices](https://abr.business.gov.au/Tools/WebServices): accept the agreement and fill in the form. The authentication GUID arrives by e-mail.
3. WooCommerce → **ABN Lookup**: paste the GUID, press "Check connection", save.
4. Open the checkout: the "ABN" field is there. Try a real number, for example 51 824 753 556.

== Frequently Asked Questions ==

= Do I need to register with ABN Lookup? =

Yes, once and free of charge: the GUID belongs to you, not to us. Until you have it the plugin checks the check digits of every ABN, but does not ask the register.

= Does it change the GST of an order? =

No. It shows whether the buyer is registered for GST and keeps that with the order. Tax is worked out by the WooCommerce tax settings.

= 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 ABN was not verified.

= Why is there no address in the answer? =

ABN Lookup publishes the state and the postcode of the main business location only, not a street address.

== Changelog ==

= 1.0.0 =
* First release.
