Shopify form error handling
<!-- I see this commonly used but there's a better way -->
{{ form.errors | default_errors }}
<!-- checking if there are errors -->
{% if form.errors %}{% endif %}
<!-- we can loop through each error and output them individually -->
{% for field in form.errors %}
<li>{{ field | capitalize }}: {{ form.errors.messages[field] }}</li>
{% endfor %}
<!-- we can also output errors on each field using the name attr of the field -->
<input type="text" name="contact[email]" />
{% if form.errors.messages.email > '' %}
{{ form.errors.messages.email }}
{% endif %}