{% extends 'shop/_layouts/checkout' %} {% set addresses = craft.commerce.customers.customer.addresses %} {% block content %} {# UI when at least one address exists #}

Where should we send your order?

{{ redirectInput('shop/checkout/shipping') }} {{ csrfInput() }} {% if not cart.email %} {{ cart.getErrors('email')|join }}
{% endif %} {% include 'shop/_includes/addresses/fieldset' with { title: "Shipping Address"|t, class: 'ShippingAddress', name: 'shippingAddress' } %} {##} {##} {% include 'shop/_includes/addresses/fieldset' with { title: "Billing Address"|t, class: 'BillingAddress hidden', name: 'billingAddress' } %}
{% include "shop/_includes/order-review" with { } %}
{% js %} var $fieldsets = $('.address-fieldset'); $fieldsets.each(function () { var $addressFieldset = $(this); $('.address-select', $addressFieldset).each(function () { this.$element = $(this); this.$radio = $('.radio input', this.$element); this.$body = $('.body', this.$element); this.$radio.change($.proxy(function () { $('.body', $addressFieldset).addClass('hidden'); this.$body.removeClass('hidden'); }, this)); if (this.$radio.is(':checked')) { this.$body.removeClass('hidden'); } }); }); $("#billingAddressSameAsShipping").change(function (e) { $('.address-fieldset.BillingAddress').toggleClass('hidden'); }); {% if (cart.billingAddressId and cart.billingAddress.hasErrors()) or (cart.billingAddressId != cart.shippingAddressId) %} $("#billingAddressSameAsShipping").click(); {% endif %} {% endjs %} {% endblock %}