How to set Multiple Localizations / Countries for Autocomplete

For Super Store Finder for WordPress and Mega Locator theme, to use multiple countries in autocomplete, you can follow below steps. (If you’re using standalone PHP version without theme, skip step 1 and refer to step 2 instructions)

1. Change the Google Maps Region to your nearest region (For Example if you’re targeting Australia and New Zealand, you can choose either Australia or New Zealand as selected) at admin settings page as screenshot below:

Google Maps Region in Super Store Finder

2. For WordPress version and Mega Locator theme, you can edit js/mega-superstorefinder.js and search / edit below code

from:

  var _autocompleter = new google.maps.places.Autocomplete(autocompleter.el, {
                    componentRestrictions: {'country': ssf_m_rgn}
                });

to:

var _autocompleter = new google.maps.places.Autocomplete(autocompleter.el, {
    types: ['(cities)'],
    componentRestrictions: {country: ['au' , 'nz'] }
 });

For standalone version

1. You can search for the following keyword in js/super-store-finder.js or js/super-store-finder-mobile.js

var autocomplete = new google.maps.places.Autocomplete($("#address")[0], {});
var origin_autocomplete = new google.maps.places.Autocomplete($("#origin-direction")[0], {});

and change it to:

var autocomplete = new google.maps.places.Autocomplete($("#address")[0], {componentRestrictions: {country: ['au' , 'nz']}});
var origin_autocomplete = new google.maps.places.Autocomplete($("#origin-direction")[0], {componentRestrictions: {country: ['au' , 'nz']}});
Important Notice: As per Google Maps Platform, you have a limit to set maximum 5 countries at a time. Your 2-digit country codes are available here.

Now if you search a postcode of 2 countries (in this example), both countries postcode will appear in the result (take note there are only max 5 slots for the auto complete, some postcodes might not appear in the result)

2 postcodes

1+