Published on April 3, 2017 by WPBeginner

Users have asked us how to add autocomplete for address fields in their WordPress forms. Autocomplete allows your visitors to quickly select an address form suggestions generated in realtime as they type. In this video we’ll show you how to add autocomplete for address fields in WordPress using the Google Places API.

Text version of this tutorial:
www.wpbeginner.com/plugins/how-to-add-autocomplete-for-address-fields-in-wordpress/

If you liked this video, then please Like and consider subscribing to our channel for more WordPress videos.

Check us out on Facebook:
www.facebook.com/wpbeginner

Follow us on Twitter:
twitter.com/wpbeginner

Join our circle on Google+:
plus.google.com/+wpbeginner/

Checkout our website for more WordPress Tutorials
www.wpbeginner.com/

Summary of this tutorial:

For this tutorial we will be using the plugin: Address Autocomplete Using Google Place API.

Address Autocomplete Using Google Place Api

With the plugin activated you will go to Settings, Google Autocomplete to configure the plugin’s settings.

It will ask for your Google Places API Key, the key allows your website to connect with Google Maps and retrieve autocomplete suggestions from their database.

You will want to visit Google’s Developer console website and create a new project, the developer console website can be found here:

console.developers.google.com/apis

Provide a name fir your project, we would recommend one that lets you identify what it is for.

You should automatically be redirected to your new project which lists the popular Google APIs you can use in your project.

Select the Google Places API key and press the enable link near the top of the page.

Click the create credentials for you to be able to use the API, as well as the What credentials do I need button, and you should see the API key you need to copy over to your WordPress plugin.

For your project you will also need to go to your library and also enable the Google Maps Javascript API and press the enable link in there as well.

You can add the autocomplete to any field in a form plugin by viewing the page the form is on and right clicking to inspect element the object.

Copy the name, ID, or CSS values for the field and paste it into the settings page.

If you would like to select multiple fields just add a comma for adding the new ID/name.

Leave a Reply

10 Comments on "How to Add Autocomplete for Address Fields in WordPress"

Notify of
avatar

Samantha James-Tharp, PA
Guest
Samantha James-Tharp, PA
15 days 3 hours ago

Hi thanks for the info ??? Also do the labels need to be named address, city and state to work? Can it just be a text field? Wanting a one line address form. I did everything you stated but using the one line text did not work.

Samantha James-Tharp, PA
Guest
Samantha James-Tharp, PA
14 days 19 hours ago

WPBeginner – WordPress Tutorials thanks for the quick response but I have been trying to get right all day is there anyway you could do a tutorial using Contact 7. I was using just the text field for a one line address then I tried multiple lines but I just can't figure it out. Thanks in advance.

WPBeginner - WordPress Tutorials
Guest
WPBeginner - WordPress Tutorials
14 days 23 hours ago

The labels shouldn't, you may want to ensure you are adding the correct class/ID for the input box.

Muhamad Farchan Fathurrahman
Guest
Muhamad Farchan Fathurrahman
19 days 15 hours ago

Hi, nice video there. Informative indeed.Does it also work for all countries ?

Muhamad Farchan Fathurrahman
Guest
Muhamad Farchan Fathurrahman
19 days 15 hours ago

thanks

WPBeginner - WordPress Tutorials
Guest
WPBeginner - WordPress Tutorials
19 days 23 hours ago

it should work for all countries

Saliou Dyallo
Guest
Saliou Dyallo
23 days 1 hour ago

Yep Yep, another wonderful vidéo 🙂

Imran Khan
Guest
Imran Khan
23 days 1 hour ago

Thanks so much! Really helpful video!!!

Neeraj Kumar
Guest
Neeraj Kumar
23 days 3 hours ago

is it only for address fields?

WPBeginner - WordPress Tutorials
Guest
WPBeginner - WordPress Tutorials
22 days 5 hours ago

For this yes it is

wpDiscuz