EarlyBirds

I hope the internet is still cool

A new WooCommerce plugin for autocompleting address

So, we’ve published a new address autocomplete plugin which uses Google Places and Maps API. It works for both the classic WooCommerce checkout and the new Blocks based WooCommerce checkout.

Why a new one?

Well, we tried few and couldn’t find one that autocompletes also the state and postal code in a reliable matter. It was a surprise and we embarked on the journey for creating a custom but simple solution.

What we found using Google Places legacy API was that the functionality lacks in two points:

  1. The state/region/county code sometimes doesn’t exist in the returned data from the API and if it is returned, it doesn’t match WooCommerce state codes. We are talking inner states, like “Bavaria” in Germany which has the official code “DE-BY”.
  2. Postal codes sometimes returned in parts.

I do not know why it is like it is, but as far as I could try and test, the data remained the same.

So what did we do?

We used the Google Maps legacy API ( future: the new API ) to retreive the usual data and then used OpenStreetMap API to get the standard state codes and it worked beautifully.

What’s next?

The first thing in our roadmap is moving to the newer Google Places API. It allows for better accuracy and provides more information, such as the postal code. This would require coding a new custom address select screen.

Furthermore, we want to implement cache for the OpenStreetMap API calls in order to keep the usage in the required limits, save their servers some load and make the plugin’s operation faster.

Other stuff about the plugin

We added some additional functionality:

  1. An option to test the plugin’s functionality for a specific WordPress user, selected from the admin panel.
  2. A house number check. A message appears when the autocompleted address does not include a house number. This might occur when the customer does not provide a house number and in the haste of buying clicks on the unnumbered address.

That’s all for now.