If you search for a location and the response is always No results found, but you are sure that stores exist in that area, then either the location you searched for exists in more than one region, or the Geocoding API doesn’t recognize the location you’ve searched for.
Set the Correct Map Region
Setting the correct map region will bias the results from the Geocoding API to a particular region.
This ensures that when a user searches for Newcastle with the “Map region” set to Australia, the Geocoding API will understand you are searching for Newcastle, Australia and not Newcastle, United Kingdom.
You can set the “Map region” by following these steps:
- Go to Store Locator > Settings
- At the top of the page, you will see the Google Maps API section
- Select the correct map region in the dropdown
- Click on “Save Changes”
Reload the store locator page and test if the store search now returns the expected results.
Include the State
Sometimes the only way you can make the Geocoding API understand the location you are searching for, even after settings the correct map region, is by including the name of the state.
If you, for example, search for St Thomas with the region bias set to Canada, it returns a location in the U.S. Virgin Islands. But if you search for St Thomas, ON with the same region bias, then the Geocoding API does return the expected data.
Check the API Response
Another possibility is that the Geocoding API doesn’t recognize the location you searched for. You can check this by making a request to the Geocoding API in your browser and see if it returns any results.
If you copy the URL below and load it in your browser, then you will see the returned geocode data for London.
Replace both london, and the uk with the details from the searched location to see if the Geocoding API recognizes it.
If the Geocoding API doesn’t recognize the provided location, it will return this data: