Billing Address always has State field?
I was under the impression the address fields were totally automatic, but when I load my check out screen the address has country of UK but also includes a mandatory State field?
This shouldn't exist on British address?
Comments
Found it!
looks like the "address.inc" file contains a switch to force Great Britian address to include the State field. not sure why? but anyway line 82 of said file, remove the 'GB' entry and all is well.
edited extract
// Those countries generally use their administrative division in postal addresses.
if (in_array($address['country'], array('AR', 'AU', 'BR', 'BS', 'BY', 'BZ', 'CA', 'CN', 'DO', 'EG', 'ES', 'FJ', 'FM', 'HN', 'ID', 'IE', 'IN', 'IT', 'JO', 'JP', 'KI', 'KN', 'KR', 'KW', 'KY', 'KZ', 'MX', 'MY', 'MZ', 'NG', 'NI', 'NR', 'NZ', 'OM', 'PA', 'PF', 'PG', 'PH', 'PR', 'PW', 'RU', 'SM', 'SO', 'SR', 'SV', 'TH', 'TW', 'UA', 'US', 'UY', 'VE', 'VI', 'VN', 'YU', 'ZA'))) {
$format['locality_block']['administrative_area'] = array(
'#title' => t('State'),
'#size' => 10,
'#required' => TRUE,
'#prefix' => ' ',
'#attributes' => array('class' => array('state')),
);
}
Issue in Addressfield queue
The way to fix this is to file an issue in the [Addressfield issue queue](http://drupal.org/project/issues/addressfield) explaining it. As you can imagine, the maintainers of Addressfield can't possibly keep up with every country without help like this. Please post the issue here.
Rename state to county
This would remove state from the form.
You could rename state to county by adding the snippet below.
Please note that the first 4 lines should be added above the last line (the comment).
// Those countries generally use the term county instead of state
if (in_array($address['country'], array('GB'))) {
$format['locality_block']['administrative_area']['#title'] = t('County');
}
// A few contries have a well-known list of administrative divisions.