Skip to main content

Ideal Postcodes ShopWired Integration

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

Activate Address Finder on your address collection forms-screenshot

Postcode Lookup

Enable Postcode Lookup on your checkout pages-screenshot


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.

  1. If you don’t have an account sign up to create a free account.
  2. Navigate to the KEYS section in your account.
  3. 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.

  1. Checkout Page
  2. Accounts Page
  3. 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 CheckoutPlatform Checkout and scroll down to Advanced Customisation.

Insert configuration code-screenshot

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 ThemesInstalled Themes click on Page Editor.

Go to theme template-screenshot

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>

Access the page editor-screenshot

Insert configuration code-screenshot

caution

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,
}
info

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.

Browser Extension-screenshot


info

For additional key settings such as daily lookup limits or URL restrictions, check out our documentation on the API Key.

info

Still need help? Contact our support team via live chat on our website or email support@ideal-postcodes.co.uk.