{% if attribute(cart, name~'Id') %}
{% set addressHasErrors = attribute(cart, name).hasErrors() %}
{% else %}
{% set addressHasErrors = false %}
{% endif %}
{% if currentUser %}
{# If we have no addresses expand the 'New Address" fields by default it to being checked. If we have errors on the address also check and expand. #}
{{ "New"|t }} {{ title }}
{% endif %}
{% if addressHasErrors %}{{ cart.getErrors(name)|join }} {% endif %}
{% include 'shop/_includes/addresses/form' with {
'modelName': name,
'address': attribute(cart, name)
} %}