<p>Currently (Dec '16) I have managed to get around this by re-using the Region/State field and passing this information through as a text field input that the user can enter.</p>

<pre><code>&lt;label class="label" for="{{ modelName }}-stateName"&gt;County&lt;/label&gt;
&lt;input type="text" id="{{ modelName }}-stateName" name="{{ modelName }}[stateName]" value="{{ model.stateName}}"&gt;
</code></pre>

<p>This ensures that the County is saved in the address model. It can be access as per any other address field in the templates.</p>

<p>I set the back-end has all States/Regions to be empty. But the user-entered text field is still stored against each customer saved address or order billing/shipping addresses.</p>

<p>The only downfall at the moment, is that in the back-end this is stored out-of order in terms of a structured UK address. The system stores this AFTER the postcode/zip code field.
So an address format looks like this;
Address Line 1<br>
Address Line 2<br>
Town/City<br>
Postcode<br>
Region<br>
Country  </p>

<p>Rather than </p>

<p>Address Line 1<br>
Address Line 2<br>
Town/City<br>
Region 
Postcode<br>
Country</p>

CC BY-SA 3.0
2016-12-11T19:20:55.053Z
2016-12-13T16:17:16.657Z
2016-12-13T16:17:16.657Z
Terry Upton
<p>Currently (Dec '16) - custom fields are not able to be used with addresses in Commerce.</p>

<p>Your best best is probably to add a field to your orders and pretend it's on addresses, but obviously if you deal with multiple addresses, as you probably do, that gets a bit tricky quickly.  You could implement a plugin that has it's own table of records that associate addressIDs with a county field.</p>

<p>I am pretty sure it's on the Commerce radar but you're a bit stuck right now I think, without some extra work.</p>

CC BY-SA 3.0
2016-12-09T23:50:14.320Z
I think I might have to make it work for UK county using the regions field and hide this away/disable for other EU countries.
Terry Upton
CC BY-SA 3.0
2016-12-10T01:50:11.150Z
You could also put all in for all countries (UK - Suffolk for example) and filter on the front end by country
Jeremy Daalder
CC BY-SA 3.0
2016-12-09T21:49:17.760Z
2016-12-09T21:49:17.760Z
Jeremy Daalder
<p>Any ideas how to add custom fields to the address Model? </p>

<p>I want to add a free text input for County, so that it can be used for the equivalent in any country, as the shop sells to more than UK. </p>

<p>Upon doing so, I get the following error when trying to edit an address;</p>

<pre><code>Craft\Commerce_AddressModel and its behaviors do not have a method or closure named "county".
</code></pre>

CC BY-SA 3.0
2016-12-09T19:13:05.103Z
There's no UI for this in the control panel since addresses aren't an element type.  Did you get that error in the context of a plugin where you tried to extend the existing `Commerce_AddressModel`?
Brad Bell
<plugin-craftcommerce>
Adding a County input field into Address in Craft Commerce
# Adding a County input field into Address in Craft Commerce

(Asked by: username_0 on 2016-12-09)

Any ideas how to add custom fields to the address Model? 
I want to add a free text input for County, so that it can be used for the equivalent in any country, as the shop sells to more than UK. 
Upon doing so, I get the following error when trying to edit an address;
Craft\Commerce_AddressModel and its behaviors do not have a method or closure named "county".

**Tags:** plugin-craftcommerce
> **Comments:**
> **username_1**: There's no UI for this in the control panel since addresses aren't an element type.  Did you get that error in the context of a plugin where you tried to extend the existing `Commerce_AddressModel`?  

---

## 2 answers

### Answer by username_0 on 2016-12-11. Score: 2 | Accepted answer

Currently (Dec '16) I have managed to get around this by re-using the Region/State field and passing this information through as a text field input that the user can enter.
County


This ensures that the County is saved in the address model. It can be access as per any other address field in the templates.
I set the back-end has all States/Regions to be empty. But the user-entered text field is still stored against each customer saved address or order billing/shipping addresses.
The only downfall at the moment, is that in the back-end this is stored out-of order in terms of a structured UK address. The system stores this AFTER the postcode/zip code field.
So an address format looks like this;
Address Line 1
Address Line 2
Town/City
Postcode
Region
Country  
Rather than 
Address Line 1
Address Line 2
Town/City
Region 
Postcode
Country


---

### Answer by username_2 on 2016-12-09. Score: 2

Currently (Dec '16) - custom fields are not able to be used with addresses in Commerce.

Your best best is probably to add a field to your orders and pretend it's on addresses, but obviously if you deal with multiple addresses, as you probably do, that gets a bit tricky quickly. You could implement a plugin that has it's own table of records that associate addressIDs with a county field.

I am pretty sure it's on the Commerce radar but you're a bit stuck right now I think, without some extra work.

> **Comments:**
> **username_0**: I think I might have to make it work for UK county using the regions field and hide this away/disable for other EU countries.  
> **username_2**: You could also put all in for all countries (UK - Suffolk for example) and filter on the front end by country  

---

