Set Default Address Form - Liquid Form Reference
On this page
Usage
```liquid
{% for address in current_customer.addresses %} {% unless address.is_default_shipping? %} {% form “set-default-address”, address: address, type: “shipping”, data-success: “sc.address-book.changed”, data-type: “json”, remote: true %} {% endform %} {% endunless %} {% endfor %} ```
The set-default-address form marks one address book entry as the signed-in customer’s default shipping or billing address. Setting a default clears the flag from whichever entry held it, so a customer always has at most one of each.
| Property | Value |
|---|---|
| Form Name | set-default-address |
| Category | Accounts |
Parameters
| Parameter | Required | Description |
|---|---|---|
address |
Yes | The CustomerAddress entry to mark |
type |
Yes | Either shipping or billing. With any other value, the form renders nothing. |
Any other tag option is passed through as an HTML attribute on the <form> element.
Pair it with remote: true and a data-success event so a reloadable {% component %} can refresh the list in place.
There is no way to clear a default
The form only sets a default. To change a default, set a different entry as the default. Clearing a default directly is not supported.
Shipping and billing are independent, and one entry may hold both.
Form Object
Inside the form block, you can access the form object which provides:
form.errors— Any validation errors after submission
Was this article helpful?
Thanks for your feedback! It helps us improve our docs.