Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Add Autocomplete for Address Fields in WordPress

Have you ever lost a customer because your WordPress form was too long or frustrating to fill out? It happens all the time. A shopper is ready to buy, but then they get stuck typing a long address, especially on a mobile device.

One small typo can mean a failed delivery, and in many cases, the customer just gives up before finishing.

That’s why address autocomplete is so helpful. It suggests the correct address as soon as users start typing, making the process faster, easier, and less likely to cause errors. The result is happier customers and fewer lost sales.

Plus, it’s easy to set up. In this guide, I’ll show you how to add address autocomplete to your WordPress forms step by step using WPForms and its Geolocation addon.

How to Add Autocomplete for Address Fields in WordPress

Why Add Autocomplete Address Fields in WordPress?

Adding address autocomplete to your WordPress site is an easy way to improve your website’s user experience. In an eCommerce store, for example, it helps customers enter their address faster and avoid typos.

Here’s how it works: As shoppers type, address suggestions, pulled from Google Places/Maps, appear. This allows them to simply pick the right one, and the form fills in automatically.

Form with an address autocomplete

That reduces errors and speeds up checkout. And faster, more accurate checkouts boost sales and make buyers more likely to return.

Beyond online stores, address autocomplete helps reduce errors in registrations and booking forms. Plus, it makes filling out any kind of form, especially on mobile, much easier.

Now that you understand the benefits of adding autocomplete address fields in WordPress, I’ll show you how to do it, step by step.

Here’s a quick overview of all the steps I’ll cover in this article:

Ready? Let’s start.

Step 1: Generate a Google Places API Key

To connect WPForms with Google Maps and enable the autocomplete address feature, you’ll need a Google Places API key. Let’s walk through the process.

🚨 Heads up: Google now requires you to set up a billing account to use their mapping services. The good news is they provide a generous free credit each month, so most small websites won’t have to pay anything to use this feature.

To get your key, you’ll need to head over to the Google Maps Platform, which is managed inside the Google Cloud Console. The console can look a bit complex, but don’t worry – I’ll walk you through the exact steps you need.

First, let’s click ‘Create Project.’

Creating a new project in Google Cloud Console

On the next screen, you’ll need to name your new project. I recommend using a name that will help you easily identify it later.

Then, if you have an organization you want to connect to, you can click the ‘Browse’ link to view a dropdown of options. Alternatively, you can select ‘No organization.’

Naming the new project in Google Cloud Console

Once everything looks good, you can hit the ‘Create’ button.

On the next screen, go ahead and open the ‘Library’ tab.

Library in Google Console

From there, you’ll need to activate three specific APIs. Think of them as a team that works together:

  • Places API: This is the star player that provides the address autocomplete suggestions as you type.
  • Maps JavaScript API: This allows you to display a map view of the selected address right on your form (which is a cool, optional feature).
  • Geocoding API: This works behind the scenes to convert addresses into map coordinates.

The easiest way to find them is by using the search bar – just search, select the API, and click ‘Enable.’ Repeat this until all three APIs are active.

Enabling the Maps JavaScript API

When that’s done, you’ll generate a unique key that your site will use to talk to Google’s APIs.

So, even though you’ve enabled three different APIs, you don’t need three separate keys. A single API key can give your site access to all of them, as long as you set the right restrictions.

To do this, you can move to the ‘Credentials’ tab. Then, you can click Create Credentials » API key.

Creating API key

This will open a panel for configuring the API key.

Under ‘Application restrictions,’ select ‘Websites’ so that the key only works on your website.

Choosing Websites as the App Restrictions

This will open the ‘Website restrictions’ configuration option.

Here, you can simply enter your domain name and click ‘Done.’

Entering the domain name for website restrictions

After that, you can continue to the ‘API restrictions’ section.

Let’s first enable the ‘Restrict key’ option.

Restricting the API key

Then, in the ‘Select APIs’ dropdown menu, you’ll want to select the three APIs you just enabled and click ‘Ok.’

This will limit the key’s access to those APIs only.

💡 Pro Tip: Restricting your API key is a super important security step. It prevents anyone else from finding your key and using it on their website. This could lead to unexpected charges to your account.

Selecting APIs to restrict the new API

After saving your changes, you’ll see your unique API key.

Go ahead and copy it – you’ll need it in the next step when connecting it to WPForms.

Copying the API key

Step 2: Install the WPForms Plugin and the Geolocation Addon

For this tutorial, we will be using WPForms, which is the best contact form builder for WordPress. It comes with a powerful Geolocation addon that makes adding address autocomplete incredibly simple.

At WPBeginner, we use WPForms to display our contact form and run our annual reader surveys. See our complete WPForms review for more insights into the plugin.

The first thing to do is sign up for a WPForms account. On their website, just click on ‘Get WPForms Now’ to get started.

The WPForms form builder plugin for WordPress

You can then select a plan and proceed with the checkout process.

💡 Note: You will need the WPForms Pro plan or higher to access the Geolocation addon. But there’s a WPForms free version if you want to test it out first.

Once you’ve signed up, you’ll need to install and activate the WPForms plugin.

From your WordPress admin area, simply navigate to Plugins » Add New Plugin.

The Add New Plugin submenu under Plugins in the WordPress admin area

After that, you can use the search feature to find the WPForms plugin.

On the search results, click ‘Install Now’ and then click the ‘Activate’ button when it appears.

The Install Now button on the WPForms search result when adding a new plugin on WordPress

If you need help, you can follow our guide on how to install a WordPress plugin.

Upon activation, you’ll need to verify your license key.

To get started, go to WPForms » Settings, enter your license key in the field provided, and click the ‘Verify Key’ button. You can find your license key in your WPForms account.

Entering your WPForms license key

With that done, you can go to WPForms » Addons from the WordPress admin panel to install the Geolocation addon.

On the next screen, browse through the options (or use the search bar) and click ‘Install Addon’ for the Geolocation addon.

Navigate to WPForms » Addons and Install the Geolocation Addon

WPForms will automatically install and activate the addon within a few moments.

Step 3: Enable Address Autocomplete in Your WordPress Forms

Now that you have your unique API key and Geolocation addon, it’s time to enable address autocomplete in your WordPress form.

Head over to WPForms » Settings from your WordPress dashboard. Then, switch to the ‘Geolocation’ tab at the top.

The Geolocation tab in WPForms settings

Here, you’ll find a few options you can adjust:

  • Places Provider – For this guide, we’ll select ‘Google Places.’
  • API Key – Go ahead and paste the unique API key you generated in Step 1. This will enable autocomplete addresses and display Google Maps inside your forms.
  • Current Location – Turn this on to automatically populate users’ locations in your forms.

Don’t forget to click ‘Save Settings’ at the bottom of this panel.

Connecting WPForms with Google Maps

Next, you just need to enable autocomplete on the form where you want to use it. You can either edit an existing form or create a new one.

Step 4: Create a Form with an Address Autocomplete

By now, you’ve connected WPForms with Google Maps. In this step, we’ll create a form with an Address field.

To start, go to WPForms » Add New from your WordPress admin area.

Clicking Add New to create a WPForms form

On the next screen, you can go ahead and give your form a name.

You’ll want to use a clear, descriptive name so it’s easier to organize as you create more forms.

Giving the form a name

After that, you’ll choose how you want to build your form: using a blank canvas, a pre-made template, or an AI form builder.

If you want to use the AI-powered form builder, then all you have to do is enter a simple prompt. WPForms AI will then generate the form for you in a few seconds.

WPForms AI forms in action

For this tutorial, though, I’ll use a ready-made template.

WPForms comes with over 2,000 form templates, making it easy to find one that’s nearly perfect for your goal.

Once you have found a good template to use as a base, just hover over it and click the ‘Use Template’ button. Here, I’ll use the Simple Contact Form template.

Use the Simple Contact Form template

This will open the drag-and-drop form builder.

Next, drag the ‘Address’ field from the left panel and drop it into your form (if it’s not already there).

Adding the Address field

Once the ‘Address’ field is in place, you can click on it to open the ‘Field Options’ panel.

Here, you can adjust the field’s label, add a field description, or choose a different address schema – US or international.

Address schema set up to international

Once you have customized the general settings, you can switch to the ‘Advanced’ tab.

Then, scroll down the panel until you find the ‘Enable Address Autocomplete’ option. Go ahead and toggle it on.

This will let users quickly autofill their full address, including city, state, and postal code, directly in your WordPress form.

Enabling address autocomplete

Enabling this feature will open the ‘Display Map’ options. Simply toggle it on to add the map to your ‘Address’ field.

Then, you can choose to show the map above or below the field in your form.

Displaying map below the field

Once you’re done, don’t forget to hit the ‘Save’ button at the top to apply your changes.

From here, you can customize your notifications and confirmations. For more details, see our guide on how to create a contact form.

Step 5: Embed Your WordPress Form with Address Autocomplete

Now, you’re ready to add your form to your WordPress site.

To start, click the ‘Embed’ button at the top of the form builder.

Embedding a WordPress form with address autocomplete

A popup will appear where you can either add the form to an existing page or create a new page.

For this tutorial, I’ll choose ‘Select Existing Page.’

Embed contact form WPForms

In the next popup, you can go ahead and choose a page from the dropdown.

Then, click ‘Let’s Go!’ to continue.

Selecting a page to embed the WordPress form with address autocomplete

WPForms will redirect you to the WordPress block editor.

Here, click the ‘+’ icon and add the WPForms block.

Adding the WPForms block

Then, select your form from the dropdown menu.

WPForms will automatically load it into the content editor.

Choosing the form to add from the dropdown

On the right-hand panel, you can adjust the ‘Form Settings.’

For example, you may want to display the form title or description to provide visitors with more context.

Configuring the form settings in content editor

You can also style your form to better match your site’s theme. And once you’re happy with the design, just hit the ‘Save’ button.

That’s it! You can now visit your form page and try typing in an address.

The address field will automatically show suggestions from Google Maps, allowing users to fill out their address with a single click.

Form with an address autocomplete

You’ve successfully added the Google address autocomplete feature to your forms.

Users will be able to autofill your form, whether they are checking out from your WooCommerce store or completing a user registration signup.

Here’s what it might look like once users select an autocomplete address suggestion:

Forms with address autocomplete

Bonus Tip: Track and Reduce Form Abandonment in WordPress

Form abandonment happens when people leave a form without submitting it, which is often due to a poor user experience.

Reducing form abandonment is important because it can hurt the growth of your email list, your eCommerce sales, and overall business success.

Studies show that over 77% of online shoppers don’t finish their checkout forms, which means losing a lot of money from incomplete sales.

By tracking and improving the forms that people often abandon, you can reduce these revenue losses.

While auto-completion can help, there are still other factors that can contribute to form abandonment:

  • Optional Fields Turned Mandatory: Making people fill out non-essential information can be really annoying.
  • Unclear Instructions: Confusing or vague form fields can make people give up.
  • Mobile Unfriendliness: Forms that are hard to use on mobile devices can be a big turn-off.
  • Technical Issues: Problems like the form not working well or slow load times can stop people from completing it.

For more details, you can read our guide on how to track and reduce form abandonment in WordPress.

FAQs About Autocomplete for Address Fields in WordPress Forms

How does address autocomplete work?

Your form connects to a location service like Google Places or Mapbox. As users type, it shows matching address suggestions. When they pick one, the fields (street, city, postal code, etc.) fill in automatically.

Will it work with my WordPress theme?

Usually, yes. Autocomplete works with most modern WordPress themes, but sometimes, custom scripts or heavily modified themes can cause conflicts.

Which WordPress plugins support address autocomplete?

Several form plugins offer this, usually through add-ons or integrations. WPForms with the Geolocation Addon is one of the best options.

What if the suggestions don’t show up?

A few common causes include a missing or incorrect API key, JavaScript errors or theme conflicts, and API restrictions (such as incorrect domain settings).

More Guides for Using WordPress Forms

I hope this article helped you learn how to add autocomplete for address fields in WordPress.

If you found this helpful, you may also want to see our other helpful guides on:

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

22 CommentsLeave a Reply

    • Thank you for letting us know, we’ll be sure to take a look and find an alternative.

      Admin

    • Hi Vinod,
      Sadly, for that customization, you would need to reach out to the plugin’s support for if they currently support multiple fields

      Admin

  1. It works thanks, I had searched of websites and plugins and nothing worked until I got to this helpful site

  2. I have a travel site, tours and transfers, I would like to install this tool, when the client selected the place of visit and the arrival was not transferred, or tour, but it is not a contact form, but rather a search form, does it work? I put the class, did everything correctly, it still does not work. Can someone help me?

  3. Hey, I tried a lot with getting API. It works fine when i use custom code from google on code pen. But when i put the same API on this plugin, it doesn’t work.

    I have enabled two APIs – Places Web and Maps JS with credentials on Places Web.

    What am i missing here

    Thanks

  4. Curious to know how to set a default country to appear first (instead of the default US addresses). Do you have any idea if there is a shortcode or some way to do this with this plugin?

    BTW, I got the plugin working by just adding into the “Name” field. It works fine for me apart from wanting it to show AU addresses first. :)

  5. How to populate the ‘current location’ in ‘area/neighborhood ‘ select dropdown as the first select option (rest of the options coming from the database) ?

  6. Hi there thanks for the article. I have followed the process you described but I still cannot get autocomplete to work at all. Is there something wrong with my google developers account ? as I can see the 2 APIs are enabled but cannot see any requests. Thanks

  7. I found a bug. When you type in the name of the business, the auto-completed address does NOT include the street number, only the street name (Main St, not 123 Main St). Big problem!!!

  8. If there is one thing we are mindful; it’s the ‘mission creep’ of Google into websites and related app areas.

    Where able, we try not to engage google into our sites so as to remain ‘in control’ in what we do.

    But thanks for the insight …

  9. Can it be possible to have the autocomplete fill out the zipcode, state and country as well? I just followed everything here and the address populates automatically but the user still has to manually input their zip code, state, and city

  10. Excellent article for autocomplete. I was looking for such a easy to go method and you guys made it.
    Autocomplete really saves a lot of time for end users which ultimately contributes to user friendly environment.

    Keep it up guys.
    Thank you

  11. I’m planned to create WP form with autocomplete, but I don’t know how to do that. After reading this post, I have an idea to create auto-complete forms.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.