One of the many benefits of the StoreConnect platform is that it provides seamless integration. This resonates with us here at Addressfinder as we are also driven to deliver a service which is smooth and seamless. To this end we have created some very easy-to-follow steps so that you can have Addressfinder up and running on your checkout in minutes. To us, this sounds like “Time. Well Spent” for both you and your customers making purchases.
Why add Addressfinder to your checkout?
Shipping outcomes
The Addressfinder service returns only verified, formatted and accurate address information which enables successful delivery on the first attempt.
Connection
When a customer can search and select their address on the checkout, they feel a connection to the sale and know the goods will soon be on their way home. When addresses are not available, customers get nervous and start to disconnect.
Time
Getting the customer to the ‘buy now’ button quickly means less time for them to be distracted or interrupted and abandon the sale.
Integration instructions
Step 1 - Creating a new script block
1.- Open the App Launcher
2.- In the search bar, search and select ‘Script blocks’.
3.- Create a new script block.
Step 2 - Populate the New Script Block
1. Give the Script Block a name (Addressfinder).
2. Choose the store for this script to be run on.
3. Paste the Widget Javascript code (below) into the Content field.
4. Save.
Step 3 - Test
1. Go to your website checkout page and start typing an address into the Street Address field.
2. Check that addresses are being displayed in a drop down box below the Street Address field.
3. Select an address and check that the address information populates the correct fields.
Widget Javascript Code:
NB: Replace the “ADDRESSFINDER_DEMO_KEY” with your Addressfinder account key in the code below.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
(function() {
var stateMappings = {
"Auckland Region" : "AUK",
"Bay of Plenty Region" : "BOP",
"Canterbury Region" : "CAN",
"Gisborne Region" : "GIS",
"Hawke's Bay Region" : "HKB",
"Manawatu-Wanganui Region" : "MWT",
"Marlborough Region" : "MBH",
"Nelson Region" : "NSN",
"Northland Region" : "NTL",
"Otago Region" : "OTA",
"Southland Region" : "STL",
"Taranaki Region" : "TKI",
"Tasman Region" : "TAS",
"Waikato Region" : "WKO",
"Wellington Region" : "WGN",
"West Coast Region" : "WTC",
"Area Outside Region" : "CIT"
};
var widget, initAddressFinder = function() {
var addr_element = document.getElementById('checkout_customer_information_form_shipping_address_1') ||
document.getElementById('checkout_customer_information_form_shipping_address_line_1');
widget = new AddressFinder.Widget(
addr_element,
'98G3HDF4XVRAQBUWKLJP',
'NZ', {
"address_params": {
"post_box": "0"
},
"max_results": "7"
}
);
widget.on('result:select', function(fullAddress, metaData) {
var combinedAddressLine1And2 = !metaData.address_line_2 ?
metaData.address_line_1 :
metaData.address_line_1 + ', ' + metaData.address_line_2;
var combinedSuburbCity = !metaData.selected_suburb ?
metaData.selected_city :
metaData.selected_suburb + ', ' + metaData.selected_city;
addr_element.value = combinedAddressLine1And2;
document.getElementById('checkout_customer_information_form_shipping_city').value = combinedSuburbCity;
document.getElementById('checkout_customer_information_form_shipping_postal_code').value = metaData.postcode;
document.getElementById('checkout_customer_information_form_shipping_state').value = stateMappings[metaData.region];
});
};
function downloadAddressFinder() {
if (
!document.getElementById('checkout_customer_information_form_shipping_address_1') &&
!document.getElementById('checkout_customer_information_form_shipping_address_line_1')
) {
return;
}
var script = document.createElement('script');
script.src = 'https://api.addressfinder.io/assets/v3/widget.js';
script.async = true;
script.onload = initAddressFinder;
document.body.appendChild(script);
};
document.addEventListener('DOMContentLoaded', downloadAddressFinder);
})();
Help and support
If you have extra fields or wish to collect other address information take a look at our custom integration guide or get in touch with us - support@addressfinder.nz.
Thanks.