Installing Address Validation for ShopWired
To add address validation to your ShopWired site, follow these simple steps. You can enable address validation on your billing or shipping address or your admin pages. This guide will walk you through signing up for a free trial, showing you where to place the script, configuring it, and exploring advanced settings.
Screenshots
Address Finder
Postcode Lookup
Step 1: Sign Up for a Free Trial
To use Ideal Postcodes, you’ll first need to create an account and get your API key.
- If you don’t have an account sign up to create a free account.
- Navigate to the KEYS section in your account.
- Copy your API Key - you’ll need this to complete the setup in WooCommerce. It’s a string of characters that begins with the letters
ak_
. On signing up your first key will have a balance of 200 free lookups for testing.
Step 2: Adding the Script
There are 3 pages you can add address validation to.
- Checkout Page
- Accounts Page
- Admin Pages
Option 1: Checkout Page
To enable Address Validation on checkout, you will need to use ShopWired's 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",
autocompleteOverride: {
populateCounty: false,
populateOrganisation: false
},
postcodeLookupOverride: {
populateCounty: false,
populateOrganisation: false
}
};
</script>
<script
async
type="text/javascript"
crossorigin="anonymous"
src=https://cdn.jsdelivr.net/npm/@ideal-postcodes/shopwired@3.0.2/dist/shopwired.min.js>
</script>
When inserting the configuration and initialisation codes into the editor, take special care to replace the apiKey
attribute in the first script tag. This should be replaced with the Key on your account.
Option 2: Accounts page
To enable Address Validation on user accounts and other pages you will need to update your ShopWired theme template.
From the Administration page sidebar, navigate to Themes
→ Installed Themes
click on Page Editor
.
From the Page Editor
, click on Views
then Templates
then master.twig
. At the bottom of the editor before </body>
, add the code below:
<script>
window.idpcConfig = {
apiKey: "Your API Key goes here",
// You can control which API to use by setting either postcodeLookup or autocomplete to false.
// For example, setting postcodeLookup: false will disable Postcode Lookup and only use Address Finder.
// Setting autocomplete: false will disable Address Finder and only use Postcode Lookup.
postcodeLookup: true,
autocomplete: true,
autocompleteOverride: {
populateCounty: false,
populateOrganisation: true
},
postcodeLookupOverride: {
populateCounty: false,
populateOrganisation: true
}
};
</script>
<script
async
type="text/javascript"
crossorigin="anonymous"
src=https://cdn.jsdelivr.net/npm/@ideal-postcodes/shopwired@3.0.2/dist/shopwired.min.js>
</script>
Make sure to update the apiKey
.
Defaults
The available configurations are:
{
// API Key is not set by default
apiKey: "",
// Postcode Lookup is enabled
postcodeLookup: true,
// Autocomplete is enabled
autocomplete: true,
// Advanced configuration
autocompleteOverride: {},
postcodeLookupOverride: {}
//These go in the override objects
// Company name field is updated
populateOrganisation: true,
// County name field is not updated
populateCounty: false,
}
For more customisation options, check out the Address Finder documentation and Postcode Lookup documentation.
Option 3: Admin Pages
To enable address validation on your admin page, you will need to use our Browser Extension.
For additional key settings such as daily lookup limits or URL restrictions, check out our documentation on the API Key.
Still need help? Contact our support team via live chat on our website or email support@ideal-postcodes.co.uk.