---- dataentry integration ----
type : integration # do not change this line
supports-foxycart-version-from : 2.0 # Minimum required FoxyCart version for this to work
supports-foxycart-version-to : # Last FoxyCart version that supports this (leave empty if unknown)
systems : crafty clicks, fetchify # the system(s) that the integration is for, separated with commas if more than one
name : Fetchify # the name of the integration
description : Add Fetchify's address lookup and validation to your checkout
tags_tags : address lookup, address validation # tags, separated by commas. don't include the "system" here.
date_dt : 2018-11-15 # the date in YYYY-MM-DD format
version : 1.0 # if you have a version for your code, enter it here
developer_url : https://fetchify.com/?affiliate=foxy # if you'd like a link back to your site, stick it here
----
====== Fetchify Address Validation ======
{{:integration:cc_logo_x.png?nolink&500|}}
The following integration adds address autocompletion and validation using Fetchify's Address Auto-Complete solution, with support for over 240 countries.
This is how it looks in action:
{{:integration:crafty-clicks-cropped-cut-350w.gif|Animation of the address autocompleting}}
For U.S. addresses, the +4 zip code will be entered in the Foxy checkout zip code field.
===== Requirements =====
* Foxy 2.0
* [[https://fetchify.com/?affiliate=foxy|Fetchify account]]
===== Installation =====
==== Step 1: Signup with Fetchify ====
This integration requires an account with Fetchify, which you can sign up for on their website at https://fetchify.com
==== Step 2: Add custom code ====
In your store's FoxyCart administration, proceed to the "configuration" section. If it's not already enabled, enable the option labelled "Add custom header and footer code to your templates".
Then, within the "footer" textarea, paste the following code:
{% if context == "checkout" %}
{% endif %}
==== Step 3: Customise code ====
At the top of the code, you'll need to update the following line with your own Access Token from your Fetchify account:
var cc_AccessToken = "XXXXX-XXXXX-XXXXX-XXXXX"; //Access Token Required for plugin to function
Below that, you'll see two blocks of variables that you can update if you wish. Most are relatively self-explanatory - but we'll highlight the first two options here in terms of the customisation you can apply.
The variable for ''cc_Search'' dictates how the customer will interact with the autocomplete. If set to ''true'', then the customer will see a separate search input above the normal address fields. If set to ''false'', there won't be a separate input, but the customer will use the normal address line 1 field.
The variable ''cc_Hide'', if set to ''true'', will hide the address fields by default, if ''cc_Search'' is also set to ''true''. Once the customer selects an address (or if an address is already prefilled), the address fields will be shown.
==== Step 4: Turn off native postcode lookup ====
As the new integration will take care of auto-filling the customers address, the normal postcode lookup functionality isn't needed, and can cause conflicts when enabled.
To turn that off, within the "configuration" section, uncheck the checkbox for "Enable city and region lookup by postal code"
Note that you should have address fields unhidden in the configuration. If your integration isn't working, try reviewing the "Customize which checkout fields are shown and required settings" on the configuration page and ensure that the Address 2 field is set to "Optional".
==== Step 5: Review Country/Region Whitelist/Blacklist ====
Fetchify supports setting a restricted list of countries that the customer can select through their UI, but currently it's not possible to set that per autocomplete, but rather for the whole page.
As such - if you restrict the billing and shipping differently, and both are present on the page - just the shipping restrictions will be utilised for the country selection in the Fetchify UI. It's also not possible to restrict regions within the Fetchify UI as you can within the FoxyCart configuration.
As the normal address fields are still used for capturing the actual address though, our normal checkout validations will still handle unique validations - but it's worth noting that the customer may be able to initially autocomplete an address that turns out to be invalid.
==== Step 6: Save and test! ====
After you've made all of the modifications to your store's configuration in the Foxy administration, save the configuration.
Now you're ready to test! Add a product to your cart, head to the checkout and you should see the address auto-complete as you type.