View Categories

Places Autocomplete Feature (Google Address Autofill)

5 min read

The Places Autocomplete feature allows customers to begin typing their address and receive suggestions by Google:

Although the primary goal of Kikote – Location Picker at Checkout for WooCommerce is for customers to choose their location on a map, this feature was added for those users who might be satisfied with just the autocomplete feature of Google Places API.

Enabling Google Places API #

To be able to use the Google Places Autocomplete feature, you need to first enable the API for the project you created for Kikote.

Step 1 #

Head over to Google Cloud Console and change over to the account and project you created for Kikote. From the menu on the left hover over the APIs & Services item and then select Libary:

Step 2 #

Search for the Places Api and select the option from the list that shows up:

Step 3 #

Enable the Places API:

Now that the Places API is enabled in Google Cloud Console, you need to enable the Places Autocomplete feature in Kikote.

Turning on Places Autocomplete Future #

To enable the feature in the plugin, turn it on from the General Settings area of Kikote:

After enabling the feature, select the fields you’d like to be set as autocomplete fields. The only options available are Billing Address 1 and Shipping Address 1 (the feature can be enabled for more fields using this filter)


NOTE

When filling out the Billing Address 1 field, the autocomplete information returned by Google will only fill in the Billing fields.

Likewise, when filling out the Shipping Address 1 field, the autocomplete information returned from Google will only fill in the Shipping fields. In addition, if the map is shown, a marker(pin) with an approximate location will be added to the map. If the user then tries to shift this marker, then their address details in the shipping fields would change to what is returned by the Google Map NOT the address details returned by the Google Place.


Force use of Autocomplete feature #

Do not turn this option on if you are making use of the Map features of the plugin. This option is for those users who are hiding the map and only using the Places Autocomplete feature.

This option prevents the customer from being able to complete the order unless they have at some point selected their address from the returned suggestions from the Google API. However, it’s understood that some addresses are not in the Google Places API database. For this reason, it’s still possible for a customer to checkout if they select a location from the suggestions, but later makes a tweak to the exact street name.

When making use of any of the Cost by Distance features, it’s HIGHLY RECOMMENDED that you turn this option on if you’re making use of the Places Autocomplete feature. This would prevent customers from being able to check out with wrong pricing before actually selecting their address.

Note that customers can still edit the address afterward, it would be your duty to confirm that the address they submitted roughly corresponds with the distance data on the order. Again, this is because Google does not have the address of all places in the world in their database.

Allowed Places AutoComplete Fields #

Select the fields where you’d like the Autocomplete feature to take effect.

Hide Map When Using Places Autocomplete #

This option hides the map from the checkout page when using the autocomplete feature. Turn on the option if you truly only need the Places Autocomplete capabilities of Kikote.

Show a searchbox inside the map #

Turning on this option will add an autocomplete text box inside the checkout page map:

Restrict Places Autocomplete Countries #

Use this option to select the list of countries you’d want the Places Autocomplete feature to be restricted to. Let’s say You’re only doing deliveries to locations in the United States. Then you’d select the United States from the list of countries so that when a customer starts typing their address it will only show results for addresses in the United States.

Places Autocomplete Type #

Use this option to select the type of results you’d like the Places Autocomplete feature to return from Google. It’s recommended that you keep this option as Precise Address.


Accuracy of Places Autocomplete #

When the map is not being hidden, and a customer makes use of the Places Autocomplete feature to enter their address, the marker on the map will be a rough estimate of the customer’s location. This is because the Places API returns the coordinates for the place selected from the dropdown which might not be exact to where they live.

Example:

John Doe lives in the 12th house of Cat Street, Cat town in Cat Country. When John comes to type in his address on the checkout page, he finds that google returns “Cat Street, Cat town, Cat Country“, he selects that street and adds “12th House” in Address Line 2. Since John selected Cat Street, Cat town, Cat Country as the Place for Address Line 1, the coordinates returned by Google will be a general one for that Place.

You will receive a notice on the order details page when a customer used the Places Autocomplete feature to select their location:

IMPORTANT: Create Budget Alerts! #

This feature calls the Google API to get suggestions as a user types in their address, it’s easy for customers to abuse this feature by spamming your checkout form. To prevent surprises, consider creating Budget Alerts for the account where you have the Kikote project so that you can be alerted when you account usage reaches a certain amount. Learn how to create budget alerts here.