Why does the plugin do not allow search by zip code out of the box?
From a User Experience point of view, because of the label of the form field, users will tend to start typing their desired street address and will be presented with address suggestions to select from. Entering the "Zipcode" in the "Street address" field doesn't feel natural to the users.
Moreover, users might confuse the first numbers presented in the address suggestions as being the "Zipcode" when, in fact, the Google Places API considers them the "house number", or vice versa.
For those reasons, only "Precise addresses" will be returned by the address search by default. This ensures the suggestions presented contain all available information for that address, including "zipcode" and the "house number".
There are some cases when it is desirable to allow users to search for zip code as in that country or culture, the "Zipcode" 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 `geocode` plus `establishment`, which in practice is the same as allowing "All types".
Visit the Google Places API documentation for more information about the supported types