Categories
Web Developing

How to Limit Google Place API Auto Complete to Certain Country

This article covers:

  1. When using Google Places API, limit the country to Australia in address auto complete suggested results. This feature was used in a Magento 1.9 One Step Checkout.

Audiences of this article:

  • Web developers

Using the region parameter

You may notice in this article, Google has covered how to control your auto complete results by manipulating Places API parameters. Unfortunately this doesn’t work for JS API, what you need is to add a region parameter, for example:

https://maps.googleapis.com/maps/api/js?region=AU&key=<your api key>

This will allow your to limit address suggestions without changing any coding.

By Ethan

To many, a business is a lifetime commitment. It's easy to start one yet difficult to make it successful. Attitude, skills, experiences and dedication help hone the craft along the way, but it's often the great vision and resilience to remain focused wins the game. Read more about me here