Why does the plugin do not allow search by zip code out of the box? #
Entering the “Zip code” in the “Street address” field doesn’t feel natural to the users. From a User Experience point of view and because of the label of the form fields, users will tend to start typing their desired street address and will be presented with address suggestions to select from.
Moreover, users might confuse the first numbers presented in the address suggestions as being the “Zip code” when, in fact, the Google Places API returns them as the “house number”, or vice versa.
For those reasons, only “Precise addresses” will be returned by default for the address suggestion results. This ensures the suggestions presented contain all information for that address, including the “Zip code” and the “house number” when the data is available.
There are some cases when it is desirable to allow users to search for “Zip code” as in that country or culture, the “Zip code” is usually the first address information the user is asked to fill in.
How to enable address search by zip code? #
Since version 1.0.1, it is possible to change the types of search results returned by the Google Places API from the plugin settings.
To enable search by “Zip code”:
- Visit the plugin settings page at WP Admin > WooCommerce > Settings > Integrations > Google Address Autocomplete.
- Change the option selected for the field “Results types” to “Geocode, except businesses (geocode)”.
- Save the changes.
Important: Please note that, due to limitations of the Google Places API, changing the type of search results may or may not work to enable search by zip code in your country or region.
What types of search results are supported? #
The types of search results available from the plugin settings are the same as the support types of the Google Places API, except for the combination of
`establishment`, which in practice is the same as allowing “All types”.
Visit the Google Places API documentation for more information about the supported types.