Skip to content

Instantly share code, notes, and snippets.

@lukeholder
Created September 14, 2016 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukeholder/5a96b75cce50790c518a3f0dc9029d1f to your computer and use it in GitHub Desktop.
Save lukeholder/5a96b75cce50790c518a3f0dc9029d1f to your computer and use it in GitHub Desktop.
simple address form
<form method="post">
{% set model = cart.shippingAddress %}
<input type="hidden" name="action" value="commerce/cart/updateCart">
<input type="hidden" name="redirect" value="placeyourredirecturlhere"/>
{{ getCsrfInput() }}
<div class="row">
<div class="six columns">
<label>First Name *</label>
<input type="text" id="shippingAddress-firstName" class="u-full-width" name="shippingAddress[firstName]" value="{{ model.firstName ?? "" }}">
{% if model and model.getErrors('firstName') %}
<span class="flash">{{ model.getErrors('firstName')|join }}</span>
{% endif %}
</div>
<div class="six columns">
<label for="shippingAddress-lastName">Last Name *</label>
<input type="text" id="shippingAddress-lastName" class="u-full-width" name="shippingAddress[lastName]" value="{{ model.lastName ?? "" }}">
{% if model and model.getErrors('lastName') %}
<span class="flash">{{ model.getErrors('lastName')|join }}</span>
{% endif %}
</div>
</div>
<input type="hidden" name="sameAddress" value="1">
<input type="submit" class="button button-primary" value="Save Address">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment