<p>I received an answer on Slack from Stephen Callendar.</p>

<pre><code>{% set addresses = craft.commerce.customer.addresses %}
{% for address in addresses %}
  {% if address.getState() %}
    {{ address.getState().abbreviation }}
  {% endif %}
{% endfor %}
</code></pre>

CC BY-SA 4.0
2018-05-17T18:30:51.030Z
2018-05-17T18:30:51.030Z
John Johnson
<p>Folks, this has to be easier than I've made it. In a front-end template, how do you grab a state abbreviation from a customer's address in Craft Commerce?</p>

<pre><code>{$ set addresses = craft.commerce.customer.addresses $}
{% for address in addresses %}
  &lt;-- this is where I want to show the abbreviation --&gt;
  {{ address.state.abbreviation }}
{% endfor %}
</code></pre>

<plugin-craftcommerce>
How to render a state abbreviation in Craft Commerce?
# How to render a state abbreviation in Craft Commerce?

(Asked by: username_0 on 2018-05-17)

Folks, this has to be easier than I've made it. In a front-end template, how do you grab a state abbreviation from a customer's address in Craft Commerce?
{$ set addresses = craft.commerce.customer.addresses $}
{% for address in addresses %}
  <-- this is where I want to show the abbreviation -->
  {{ address.state.abbreviation }}
{% endfor %}

**Tags:** plugin-craftcommerce


---

## 1 answers

### Answer by username_0 on 2018-05-17. Score: 1 | Accepted answer

I received an answer on Slack from Stephen Callendar.
{% set addresses = craft.commerce.customer.addresses %}
{% for address in addresses %}
  {% if address.getState() %}
    {{ address.getState().abbreviation }}
  {% endif %}
{% endfor %}


---

