Shopwired Integration for UK Address Search and Validation
Updated 15 Mar 2021
Ideal Postcodes provides a ShopWired integration that facilitates UK address search and validation across a ShopWired Store.
This extension is free to download and install. However, our address validation services require a paid account at ideal-postcodes.co.uk.
This integration works by hooking into the custom scripts enabled for Google Analytics. It waits until a valid address form is present before binding itself.
Contact us if you get stuck. Drop by our developer chat page for in-depth assistance.
If you need support, you can either reach out to us on our support page or drop by our developer chat page.
This integration is installed via adding our initialisation script via Advanced Customisation.
From the Administration page sidebar, navigate to Checkout
→ Platform Checkout
and scroll down to Advanced Customisation
.
In the Script contents
editor, insert the below configuration code and click on Save
.
<script>
window.idpcConfig = {
apiKey: "Your API Key goes here"
};
</script>
<script
async
type="text/javascript"
crossorigin="anonymous"
src="https://cdn.jsdelivr.net/npm/@ideal-postcodes/shopwired@1">
</script>
When inserting the configuration and initialisation codes into the editor, take special care to replace the following:
apiKey
attribute in the first script tag. This should be replaced with the Key on your account.The plugin needs to download external assets like jQuery to function. You can speed up the plugin load times by pre-emptively fetching the necessary scripts. To speed up load times, add the following above your activation code:
<script
src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous">
</script>
<script
src="https://cdn.jsdelivr.net/npm/jquery-postcodes@3.0.8/dist/postcodes.min.js" integrity="sha256-JZSN3ZEXOFlpSMFjQkHjbKnjHlsFVf8N7p1SbCI0XHI="
crossorigin="anonymous">
</script>
<script
src="https://cdn.jsdelivr.net/npm/ideal-postcodes-autocomplete@0.2.1/dist/ideal-postcodes-autocomplete.min.js" integrity="sha256-lZPaPHBx7V2Gj9iAc8QfVcW02KlWB2gbrqXpGfiEGgo="
crossorigin="anonymous">
</script>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/ideal-postcodes-autocomplete@0.2.1/css/ideal-postcodes-autocomplete.css" integrity="sha256-ewtQO/9EEPz6LsP/kWLv+bzykzIAr+d6s0WqA2B4clQ="
crossorigin="anonymous"
/>
Your first key on your Ideal Postcodes account will carry a free test balance which you can use to verify and test your integration. Please contact support if you need a larger test balance.
In order to go live, you will need to purchase a balance of lookups on your API Key. This can be done manually or automated from your dashboard. Each address search consumes one lookup from your Key balance.
See our account setup guide for the quickest way to go live by creating your first API Key and enabling automated top-ups.
The minimum configuration is as follows:
<script>
window.idpcConfig = {
apiKey: "Your API Key goes here"
};
</script>
See our integration configuration guide to understand how to customise this.
The available configuration attributes for the configuration are as follows:
{
// API Key is not set by default
apiKey: "",
// Postcode Lookup is enabled
postcodeLookup: true,
// Autocomplete is enabled
autocomplete: true,
// Company name field is updated
populateOrganisation: true,
// County name field is not updated
populateCounty: false,
// Advanced configuration
autocompleteOverride: {},
postcodeLookupOverride: {}
}
This integration will be continually updated without your action. However there will be occassion when a backwards breaking change is introduced. When this happens we will increment the version number at the end of the script src
.
It's possible to fix the version number of the integration script. The version suffix @VERSION
in src
can be replaced with a specific version number. Versions are automatically logged and tracked on our Changelog.
Your API Key is central to how our service recognises your integration. See our guide on API Keys to find out more.
API Keys can also be safeguarded against potential misuse. Please see our guide on securing your API Key to find out more.