Australian address autocomplete for WooCommerce

About 12 minutes. Updated 30 September 2026.

Install the Locio plugin on a WooCommerce shop: suggestions as the customer types at checkout, a check against G-NAF when the order is placed, and the G-NAF id saved on the order. With a local test shop you can stand up in two commands.

A parcel sent to an address that does not exist comes back, and the shop pays twice. The Locio plugin stops most of those at the checkout: the customer types the start of their address, picks it from a list, and the street, suburb, state and postcode fill themselves in. When the order is placed, the address is checked against G-NAF, the national register of every Australian address, and the order carries its G-NAF id and coordinates.

It works on the block checkout, which new shops get by default, and on the classic checkout. It needs WordPress 6.4 or later, WooCommerce, and PHP 8.2.

01Install WooCommerce

WooCommerce is a plugin like any other. In WordPress, go to Plugins, then Add New Plugin, search for WooCommerce, press Install Now, then Activate. Its setup wizard asks where the shop is; say Australia. Skip this step if your shop already runs on WooCommerce.

02Create your keys

The plugin uses two keys, because it works in two places. Create both on the Keys page.

  • A public key (lc_pub_...) for the suggestions. It is printed into your checkout page, which is safe: it only answers pages on the allowed origins you list, so a copy lifted from your shop does nothing anywhere else. Add your shop's address, for example https://shop.example.com.au, and http://localhost:8080 if you will try it locally first.
  • A secret key (lc_live_...) for the check when an order is placed. It stays on your server. It is optional: without it you still get suggestions, just no check.

03Install the plugin

Until the plugin is listed on wordpress.org, it installs from a zip. Download locio-address-autocomplete.zip, then in WordPress:

  1. Go to Plugins, then Add New Plugin.
  2. Choose Upload Plugin at the top, pick the zip, and press Install Now.
  3. Press Activate. WooCommerce must already be active; the plugin says so if it is not.

Or, on a server with WP-CLI, in one line:

shell
wp plugin install https://github.com/locio-au/locio-woocommerce/releases/latest/download/locio-address-autocomplete.zip --activate

The plugin is open source under the GPL. The zip is the source exactly as it is in the repository, with nothing minified or built, so you can read every line before it goes near your shop. The source, issues and changes are on GitHub, and contributions are welcome.

04Paste the keys

Open WooCommerce, then Locio. Paste the public key and save. Suggestions start working on the next checkout you load.

For the secret key you have two choices. Paste it into the secret key field, where it is stored in the database and never shown again (the page shows its last four characters so you can tell which one it is). Or, better on a site other people administer, keep it out of the database entirely by defining it in wp-config.php:

wp-config.phpphp
// wp-config.php, above the line that says "That's all, stop editing!"
define( 'LOCIO_SECRET_KEY', 'lc_live_...' );

With LOCIO_SECRET_KEY defined, the settings page says so and ignores the field. The plugin refuses a secret key pasted into the public key field, since that field ends up in your page.

05Choose what happens to an address we cannot find

The When an address is not found setting has three answers:

  • Do not check. Suggestions only.
  • Accept the order and add a note. The default. The order goes through with a note saying the address was not found, so somebody can look before it ships.
  • Ask the customer to correct it. The checkout refuses the address with a message asking them to check it or pick a suggestion.

Whichever you choose, an outage of ours never blocks a sale. If the check cannot run, because of a timeout, a rate limit, a spent quota or a revoked key, the order goes through and is marked unchecked, with a note saying why.

06Try it

Add something to the cart and open the checkout. Type 1 george st syd into the street address: suggestions appear as you type, from the search endpoint. Pick one, and the suburb, state and postcode fill in. Keyboard works too: arrows to move, Enter to pick, Escape to close.

Place the order. On the order screen in the admin, under the shipping address, you will see its G-NAF id, checked through resolve. The same details are saved as order meta, for anything downstream that wants them:

php
$order = wc_get_order( $order_id );

$status = $order->get_meta( '_locio_status' );      // matched, unmatched or unchecked
$id     = $order->get_meta( '_locio_address_id' );  // the G-NAF Address Detail PID
$lat    = $order->get_meta( '_locio_lat' );
$lng    = $order->get_meta( '_locio_lng' );
$mesh   = $order->get_meta( '_locio_mesh_block' );  // ABS mesh block, for census joins

Suggestions appear for Australian addresses only. A customer who picks another country checks out exactly as before.

A test shop on your own machine

To try the plugin before it goes near a real shop, the locio-woocommerce-dev repository stands up WordPress, WooCommerce and the plugin with podman and nothing else:

shell
git clone https://github.com/locio-au/locio-woocommerce.git
git clone https://github.com/locio-au/locio-woocommerce-dev.git
cd locio-woocommerce-dev
cp .env.example .env    # set ADMIN_PASSWORD and LOCIO_PUBLIC_KEY
make

That starts MariaDB and the latest WordPress in one pod, installs WooCommerce, and sets up an Australian shop: a product, flat rate shipping, cash on delivery so an order can be placed without a payment account, and both a block checkout at /checkout/ and a classic checkout at /classic-checkout/. It answers on http://localhost:8080, so add that to your public key's allowed origins. On a Mac, run podman machine start first.

In that shop the plugin is already installed: it is your checkout of the plugin, mounted read only, so there is nothing to upload, and an upload over it fails. To try the real install from the zip instead, add PLUGIN_DIR=none to .env and run make reset, then make.

What it costs

Each suggestion request is one unit, and each order check is one unit. Typing is debounced, so a customer typing an address costs a handful of units, not one per key. See pricing for what a plan includes.

When suggestions do not appear

  • The origin is not allowed. The browser's console shows a 403. Add the exact address the shop is served from, scheme and port included, to the public key.
  • The country is not Australia. Suggestions follow the country field.
  • An optimisation plugin rewrote the script. Exclude locio-checkout from script combining, or clear its cache.
  • A Content Security Policy blocks the request. Allow https://api.locio.com.au in connect-src.

A dark theme

The suggestions list reads five CSS variables. Set them in your theme to match it:

css
.locio-panel {
  --locio-bg: #111;
  --locio-fg: #eee;
  --locio-muted: #999;
  --locio-line: #333;
  --locio-active: #222;
}

Address data is G-NAF, published by Geoscape Australia under CC BY 4.0; the plugin credits it in the suggestions list.

Related