How do I change my address format?

Addresses are entered and displayed using a default format for each country. This default is derived from the Address Field module itself, meaning we had to hardcode the names of fields, allowed values, and display formats per country. We could only do this for countries whose formats we were sure of, so there are plenty that still retain generic defaults.

The first thing to do if you find that your addresses aren't formatted properly for your country is to check the issue queue for an existing issue for your country. If it exists, comment on that issue if it is still unresolved. Otherwise, create a new one describing the proper fields required to collect and represent addresses accurately for your country.

Please note that while it can make sense to include allowed values for things like county / province selection, this is not usually a requirement for valid mailing addresses. It is best to only include allowed values where you must ensure a specific format or answer. The most common use case for requiring them is if payment or shipping services for your country tend to require a particular value for a field, such as with the State in an address for the United States of America.

Changing the format is a trivial fix that can be done in minutes. Upon the next release of the module, your country will be included. We'll respond with a patch for your particular country when we commit the fix that you can use in the meantime.

If the default is not suitable for your website, it can be altered via the module's API.


markie on June 20, 2011

Just want to clear up what is meant by the last line in this entry. Are we talking about the Address Field API, or commerce_customer? Because, honestly, I'm not finding it in either.

I know.. I nit pick.

rfay Randy Fay on June 23, 2011

I think hook_addressfield_mapping_alter(); That's what I find. You could also hook_form_alter() for certain effects.