Getting started with Google Address Autocomplete

Getting started with Google Address Autocomplete



How to get the Google Places API Key from Google


Set up an account at Google Cloud Console

First, you'll need to set up your Google Cloud Console Account, Enable billing and Create a new project.

Follow the instructions on the Google Places API documentation:

Note that depending on your usage, charges from Google might be incurred.
Currently, Google gives you 200 USD/month in credits towards using their Places and Maps APIs, along with other resources.
That is enough for processing roughly 11.000 orders with address autocompletion in your store.
See more about Google Maps Platform pricing
More information can be found on the Google Places API documentation

Authorize Google Libraries (APIs) to be used with your API key

Make sure you enable the following libraries:
  1. Places API (required)
  2. Maps JavaScript API (required)
The libraries below are optional and only needed if you use "Geocode" for the type of address suggestion results, which 99% of websites won't need:
  1. Geocoding API (optional)
  2. Geolocation API (optional)

Follow the instructions below for each API key you want to enable, and at least for the required APIs.

Inside Google Cloud Console, select your project at the top, then access the Menu > APIs & Services > Libraries.




Search for the library you want to enable, for example, "Places API" and "Maps API" which are required:




Select the desired library/API from the results list:




Enable the library/API for your project by clicking the "Enable" button.



If the "Enable" button is not displayed, but a "Manage" button is displayed instead, it means the library is already enabled for your project. In this case, proceed with enabling the other libraries/APIs, or proceed to create your API key credential.

Repeat the process to enable all desired libraries/APIs.

Create your API key credential to access the Google services

Inside Google Cloud Console, select your project at the top, then access the Menu > APIs & Services > Credentials.




You will see a list of existing API Keys and other credentials you might already have created for your project.

From the top, click the button "Create Credentials", then select the option "API key".



Add a descriptive name for your API key, select "HTTP referrers (web sites)" for "Applications restrictions", and add your domain name to the "Website restrictions".


Adding these restrictions is important to make sure only your websites can use the API key, avoiding extra charges from unauthorized use.


In the API restrictions, select "Restrict key", then open the "APIs" dropdown list and select the desired APIs:

Make sure to select at least the required APIs:
  1. Places API (required)
  2. Maps JavaScript API (required)




Check that the required APIs are selected, then save your new API key.




Now, copy your API key and add it to the Google Address Autocomplete plugin settings:



How to enable Address Autocompletion on the plugin settings

To enable the Address Autocompletion, enter the following information on the plugin settings page at WP Admin > WooCommerce > Settings > Integrations > Google Address Autocomplete:
  1. Plugin License Key
  2. Google Address Autocomplete checkbox (checked)
  3. Google Places API Key



How to enable autocomplete via the CEP field for Brazilian websites

To enable the Autocompletion via the CEP field, enter the following information on the plugin settings page at WP Admin > WooCommerce > Settings > Integrations > Google Address Autocomplete:
  1. Plugin License Key
  2. Enable Brasil API Address Autocomplete (checked)
An API key is not required for this option.
You can use autocomplete via CEP alone or in conjunction with the Google Address Autocomplete feature.

How to fix the error "Sorry, something went wrong"

You probably missed adding the libraries restrictions to your Google Places API Key, please follow the tutorial from the beginning.

If you have followed this tutorial from the beginning and still get an error, please contact our support.

    • Related Articles

    • How to enable users to search addresses by zip code?

      Why does the plugin do not allow search by zip code out of the box? From a User Experience point of view, because of the label of the form field, users will tend to start typing their desired street address and will be presented with address ...