Determine the Center of the Map by Customer Location

By default, Store Locator will show a general map of your region on page load. You can customize the view of your map to show your customer's current location.

If your customer has location services enabled in their browser, it will show their current location in the center of the map. The map would also include any nearby stores in their area.

To determine the center of the map by customer location, please follow the steps below.




  1. From within the Store Locator app, select Settings.

    select settings

  2. Select Display Settings.

    select display settings

  3. Copy and paste this code into the Page Footer HTML field:
    var map = boldMap
    if (typeof map === 'undefined') {
    var infoWindow = new google.maps.InfoWindow({map: map});
     navigator.geolocation.getCurrentPosition(function(position) {
     var pos = {
     lat: position.coords.latitude,
     lng: position.coords.longitude
     infoWindow.setContent('Location found.');
     jQuery('.search_bar button').click();
     }, function() {
     handleLocationError(true, infoWindow, map.getCenter());
     function handleLocationError(browserHasGeolocation, infoWindow, pos) {
     infoWindow.setContent(browserHasGeolocation ?
     'Error: The Geolocation service failed.' :
     'Error: Your browser doesn\'t support geolocation.');

    paste this code in the Page Footer HTML

  4. Select Save.
Was this article helpful?
0 out of 1 found this helpful