Gravity forms is the most popular premium forms plugin for WordPress and one of the best plugins all round. If you’re a non U.S developer, you may need to customize the address fields to display states, provinces or regions for a specific country.
Gravity forms, out of the box, only displays United states & Canadian states with a default International field.
In this tutorial i’ll show you how to add country filters to create non U.S address types for Australian state’s, U.K states and Brazilian states for custom address fields.
There’s already an International address type included but it doesn’t display specific countries or non U.S states.
Add this code to your theme’s functions.php file (A child theme or custom functions.php file is suggested otherwise your custom code will be lost when you update your theme).
Requirements
If you don’t already own a Gravity forms license, you’ll need to purchase Gravity forms license.
United Kingdom Address Type Code
If you’re not from any of these countries you could easily edit the above code for your own country and create address form fields using the excellent form plugin, Gravity forms.
Australian Address Type Code
I’ve already written several other posts on how to customize gravity forms and i’ll be writing more in the future as its such a hugely popular plugin.
Here’s another address type for Brazil:
Brazilian Address Type Code
If you have any other country code address types you have used already, you are welcome to send them to me which will help other Developers using the contact form.
Please how can I add Kenya Address Type Code. normally use P.O. Box
Thanks in advance.