Edit a single address in Commerce I've read the docs but I can't seem to get this to work properly. I want to edit a single address on a separate page from where all addresses for a customer are listed. I have the link to the edit page, which looks like this:

&lt;a href="{{ url('account/edit-address') }}?addressId={{ address.id }}"&gt;Edit&lt;/a&gt;


Then on that edit-address template I have the following:

{% set addressId = craft.request.getParam('addressId') %}

&lt;form method="post"&gt;
    {{ getCsrfInput() }}
    &lt;input type="hidden" name="action" value="commerce/customerAddresses/save"&gt;
    &lt;input type="hidden" name="redirect" value="account/address-book"&gt;

    {% if addressId %}
        &lt;input type="hidden" name="address[id]" value="{{ addressId }}"&gt;
    {% endif %}

    &lt;input type="text" name="address[firstName]" value="{{ address ? address[firstName] : '' }}"&gt;
    &lt;input type="text" name="address[lastName]" value="{{ address ? address[lastName] : '' }}"&gt;
&lt;/form&gt;


That leads to a "Variable 'address' does not exist" error. I understand why I get that error but I'm not sure how to get the value field to show the address info. Having a blank form field isn't going to cut it.
Are you looking for something like this? The second example will ensure an address variable exists, even if it is set to null.

{% set address = craft.commerce.customer.address(addressId) %}

or

{% set address = address is defined ? address : null %}

As for accessing the data, you would just do this:

{{ address ? address.firstName : '' }}

Another way to do it (without needing to define a null address variable) is:

{{ address.firstName ?? '' }}