John Pitcairn’s picture

Status: Active » Needs review
1.21 KB

And here's the patch...

vIQleS’s picture

Sorry for being a noob, but what do I do with that?

And why can't it be changed in the UI somehow?

Gold’s picture


It's a patch file. It's used to apply changes other people have made to their code to your code.


  • Buggy code is fixed. The .patch is the difference between the buggy code and the fixed code.
  • You grab the .patch and run it through "patch" to make the same changes on your code.

The technical bits on how to do this is available here;

John Pitcairn’s picture

It can't be changed in the UI because there isn't a UI to do it. And there shouldn't be a UI, because the whole point of the addressfield module is that it automatically displays the correct address fields for each country. The address fields used for NZ are not correct, and this patch corrects that. If the patch is committed by the module maintainer, nobody will ever have to deal with this problem again.

Meanwhile, to fix it you need to patch the module. See the handbook page for applying patches:

Gold’s picture

Status: Needs review » Needs work

While New Zealand doesn't have states we do have regions so I would go for renaming this lable

While we have regions, from a postal address point of view they are not compulsory so making this field non-required would be the better way to go.

I was going to do this over the weekend. Shall add the patch here instead of on the issue I made.

Gold’s picture

I'll also roll the changes from (thanks dollar_dad) into this. He's taken the time to add the Regions and also pointed out that Zip aught to be Postal Code.

Gold’s picture

Title: Remove State field for New Zealand » Tidy up New Zealand address format


State -> Region (and optional)
Region gets list of regions
Zip becomes Postcode

John Pitcairn’s picture

Sounds good. Predefined regions would be handy to have as an easy way to route submissions to relevant company branches.

Gold’s picture

Status: Needs work » Needs review
2.09 KB

This patch makes the following changes;

  • State becomes Region
  • Region is optional
  • Region has an option list of current Regions with a blank as the first option
  • ZIP becomes Postcode
  • City becomes City/Town

Kudos to dollar_dad for the region list.

mjcarter’s picture

Sweet, nice work, works well for me. I'm using this with the postcode field optional too

jonathan_hunt’s picture

Status: Needs review » Needs work

Works for me, though you may wish to reroll with fixed spelling:
+ // A few contries have a well-known list of administrative divisions or
should be
+ // A few countries have a well-known list of administrative divisions or

Gold’s picture

Status: Needs work » Needs review
2.09 KB

Heh... The spell checker in my editor didn't highlight that... :) Looking at the patch though I added to the existing comment. But yeah, fair enough. :)

wiifm’s picture

Status: Needs review » Reviewed & tested by the community

Patch looks good to me, works as desired, and is a massive improvement for all people living in NZ.

Can this be committed?

babbage’s picture

Category: task » bug

The defaults built into the module include a required field for "State" in New Zealand and there are no states in New Zealand. This is therefore a bug.

babbage’s picture

Title: Tidy up New Zealand address format » Correct error of required State field in New Zealand address format

More accurate title.

babbage’s picture

[Form submission blip in my browser.]

snlnz’s picture

patch in #12 works a treat thanks @Gold :)

EDIT: Though, wouldn't it make sense to rename CITY/Town to just Town and move the TOWN field to the right of the Region field? :)
Just a thought!

mjcarter’s picture

I think the postcode field should be optional by default.

If it's not required for a delivery to be sent out, it shouldn't be required in the form. A few countries do officially require a postcode for mail services but NZ is not one of them.

In June 2006, New Zealand introduced a new postcode system ... New Zealand Post did not require individual items of mail to include the post code in the address, as optical character recognition (OCR) enabled automated sorting machines to scan entire addresses, rather than just post codes, as was the case with older machines.

The reason this field should be optional, apart from postcodes serving little function in the NZ post system, is based on CRO - there is a correlation between the number of required fields and checkout abandonment rate, especially if fields are things that people may have forgotten or not know off-hand in certain circumstances - for example ordering as a gift to be delivered to a relative or friend.

I agree with #17 @snlnz (though "town/suburb" I would suggest as the label), if all NZ cities are in the regions list.

ericgsmith’s picture

Auckland appears to be missing from the last patch?

willieseabrook’s picture

Yes Auckland was missing! Thanks @ericgsmith.

Regarding @mjcarter comment in #18 This makes post code not required.

Most people in NZ don't know their post codes, it's not like the US or CA where post code is golden. So I agree it shouldn't be required.

John Pitcairn’s picture

Consider the situation where you are not delivering a product, you are collecting address data that will later be used for a bulk postal mailout (with user opt-in of course). In that case, NZ Post does require a postcode. So that use-case definitely needs a required postcode field.

wiifm’s picture

Whether people know their postcode or not is not the point here, the latest standard for sending letters in NZ clearly states that a postcode is always required (see )

My advice would be to leave the postcode field as required (for the 90% use case where something would be sent to the address), and for the leave it to the 10% who require the address for other purposes to use a form_alter.

On that note, I am keen for #19 to be committed.


willieseabrook’s picture

I say that people knowing or not knowing their postal code is critical for commerce sites - putting impediments to completing the checkout process will lead to cart abandonment and lost dollars.

In reality, courier companies don't *require* postal codes, and neither does NZ Post for mail delivery (yes they all state the requirement in specs but they will still deliver without one). Yes for bulk delivery NZ Post does require a postal code, but what percentage of use of address is for commerce sites, and what percentage is for collecting physical mail addresses for bulk postal deliveries?

At the same time, even though making it required will lead to cart abandonment, anyone using this for commerce sites can simply form alter and disable the requirement, or patch as I have done.

So I'm also in favor of #19 being committed.

I don't think this should block committing, as this is an urgent patch for regular users, but perhaps a required/not required checkbox in the field settings could be an option?

j0rd’s picture

Issue tags: +pluggable regions

This is a duplicate of
#1829900: [meta] Address Field 2.x needs pluggable administrative areas and an actual API

If you think so to, please close your ticket.

mjcarter’s picture

I guess the ultimate fix would be storing compulsory value flags in the DB with a UI to adjust, if I hadn't installed this patch I probably wouldn't have had a clue where to look to change the setting (easy then though).

It's a good call about the addressfield having other uses than just commerce.

At the moment it seems like 3-2 on opinions of whether it should be compulsory or not.

I still stand by my opinion it should be optional, but am making the assumption that the majority of sites using this module are not doing so for bulk mailing purposes.

snlnz’s picture

I'd like to see the patch committed as is from #20 as it is a step in the right direction either way for NZers.

rszrama’s picture

Title: Correct error of required State field in New Zealand address format » Add administrative area #options for New Zealand regions
Component: Code » Address formats
Category: bug » task
Status: Reviewed & tested by the community » Fixed

Per j0rd's comment, perhaps when we have an improved DX around adjusting address formats, the question of whether or not the postal code should be required will be simpler to resolve. In the meantime, I'm going to commit #19 that leaves it as required since that appears to be the standard. In the interest of matching strings with the GB address formatting, I've switched "City/Town" to "Town/City".

Automatically closed -- issue fixed for 2 weeks with no activity.

bojanz’s picture

Issue summary: View changes

Everyone, please comment on #2387967: Remove New Zealand regions.