customer_address
Generate forms for creating new addresses, editing or deleting existing addresses on customer accounts.
Params
return_to{String}Redirect URL after form submit, defaults to the current page URL.
Inputs
| input | type | name | required | remarks |
|---|---|---|---|---|
| first name | text | address[firstName] | no | |
| last name | text | address[lastName] | no | |
| address 1 | text | address[addr] | no | |
| address 2 | text | address[addrTwo] | no | |
| city | text | address[city] | no | |
| city code | text | address[cityCode] | no | |
| company | text | address[company] | no | |
| country/region | text | address[country] | no | |
| country/district code | text | address[countryCodeStr] | no | |
| district | text | address[district] | no | |
| district code | text | address[districtCode] | no | |
| phone | text | address[mobilePhone] | no | |
| province | text | address[province] | no | |
| province code | text | address[provinceCode] | no | |
| zip code | text | address[zipCode] | no | |
| default address or not | boolean | address[def] | no |
Example
create
{{#form "customer_address" id="customer_address" class="customer-form"}}
<div class="addr">
<label for="addr">address</label>
<input type="text" name="addr" placeholder="address" />
</div>
<div class="submit">
<input class="submit-button" type="submit" value="submit">
</div>
{{/form}}
edit
The address parameter is supported for the form to display the corresponding field, e.g. the address passed in is
{{#form "customer_address" id="customer_address" address=address class="customer-form" return_to="/"}}
<div class="field">
<label for="addr">addr</label>
<input type="text" id="addr" name="address[addr]" title="addr" placeholder="addr" value="{{address.addr}}">
</div>
{{/form}}
delete
Supports the address_seq parameter, which corresponds to the id field of the address and is used to process the address to be deleted:
{{#form "customer_address" id="customer_address" address_seq="SL20230104" class="customer-form" return_to="/"}}{{/form}}
Was this article helpful to you?