Adds a UK postcode lookup tool into WooCommerce's checkout process.
This plugin enables your customers to complete their billing/shipping addresses by entering their postcode and selecting their address from the options given.
It utilises getAddress.io (https://getaddress.io) to do the lookup using their Royal Mail Postcode Address File.
An API key is required for the integration to work, and the integration only appears when the customer has selected United Kingdom (or, more specifically, the ISO-3166-2 code “GB”) for their country.
It can optionally be turned off for the shipping or billing addresses, and can be enabled or disabled in each of the checkout, customer account and WooCommerce admin screens.
Postcodes that are looked up are saved in a custom database table for 24 hours to help reduce your costs for use of the getAddress.io API.
WooCommerce, at least version 3.0.
getAddress.io API Key. A number of pricing plans are available.
Once installed and activated, you need to go to the WooCommerce -> Settings -> General page in the WordPress dashboard. You can enter your API key and set your other options here.
Certain plugins that also modify checkout fields can conflict with this plugin and prevent it from working.
Usually, the symptom of this is that the “Find Address” button does not appear.
Since version 2.1, I’ve added a Hook Priority setting at the bottom of the settings for the plugin that you can use to try and fix these conflicts.
The default priority is 10, but using a higher number makes my plugin modify the checkout later in the process – you will probably need to experiment to find the priority that makes my plugin’s changes happen after the conflicting plugin.
For example, a priority of 1001 seems to fix conflicts with the “Checkout Field Editor” plugin by ThemeHigh.
For developers, I’ve included a few filters that you can use to customise certain aspects of the plugin. These are:
All of these filters take one argument, $text
.
gazchaps-woocommerce-getaddress-io_find-address-button-text - the text shown on the Find Address buttons (default: Find Address) gazchaps-woocommerce-getaddress-io_find-address-searching-text - the text shown when the Find Address button is selected (default: Searching...) gazchaps-woocommerce-getaddress-io_enter-address-manually-text - the text shown for the "Enter an address manually" link (default: Enter an address manually)
Note: Although these two texts are translatable, filters will override any translations.
All of these filters take one argument, $message
, the error message that will be displayed to the user.
gazchaps-woocommerce-getaddress-io_api_error_400 - shown when the postcode supplied is invalid/empty gazchaps-woocommerce-getaddress-io_api_error_401 - shown when the API key provided in the settings is invalid gazchaps-woocommerce-getaddress-io_api_error_404 - shown when no addresses were found for the supplied postcode gazchaps-woocommerce-getaddress-io_api_error_429 - shown when the API key has hit its usage limit gazchaps-woocommerce-getaddress-io_api_error_500 - shown when there is a server error at getAddress.io
Note: By default, the error messages are “customer friendly”, i.e. they don’t go into much detail about the cause of the error!
gazchaps-woocommerce-getaddress-io_billing_selector_row_class - changes the CSS class on the form-row that the billing address selector is placed into gazchaps-woocommerce-getaddress-io_shipping_selector_row_class - changes the CSS class on the form-row that the shipping address selector is placed into gazchaps-woocommerce-getaddress-io_clear_additional_fields - defaults to true, set to '__return_false' to stop the "additional fields" area of the checkout having a clear style applied to it<h3>License</h3>Licensed under the [GNU General Public License v2.0](http://www.gnu.org/licenses/gpl-2.0.html)
Install via the WordPress Plugin Directory, or download a release from this repository and install as you would a normal WordPress plugin.