Skip to content
  1. Extras
  2. mscAddress

mscAddress ​

User addresses for the account and checkout page. The component works only for authenticated users.

How to use ​

In the tpl.msOrder chunk, inside the form, output addresses:

modx
<form class="form-horizontal ms2_form" id="msOrder" method="post">
    <div class="row">
        <div class="col-md-6">
            [[!mscAddress?
                &tpl=`tpl.mscaSelect`
            ]]
        </div>
    </div>
...
</form>
fenom
<form class="form-horizontal ms2_form" id="msOrder" method="post">
    <div class="row">
        <div class="col-md-6">
            {$_modx->runSnippet('!mscAddress', [
                'tpl' => 'tpl.mscaSelect',
            ])}
        </div>
    </div>
...
</form>

When the user changes the select on checkout, the corresponding fields are filled from the saved address.

On the account page, call the snippet to manage addresses:

modx
[[!mscAddress]]
fenom
{'!mscAddress'|snippet}

If the "Add address" button does not appear in the account, check the tpl.mscaAddresses chunk; the button may be hidden by missing CSS.

mscAddress parameters ​

NameDefaultDescription
tpltpl.mscaAddressesChunk for the address list.
tplFormtpl.mscaFormChunk for the address edit form.

Chunk tpl.mscaSelect is used for the address select on checkout.

System settings ​

NameDefaultDescription
msca_address_handlermscaAddressHandlerClass that implements address logic.
msca_requirescity,street,buildingRequired fields for adding an address.
msca_frontend_css[[+cssUrl]]web/default.cssPath to CSS file.
msca_frontend_js[[+jsUrl]]web/default.jsPath to JS file.