Allows to update a list of states when a customer select some country in the country list.
Usually this AJAX handler used on the
Checkout page together with
shop:checkout action,
but it can be used on any other page for updating the state list. Usage example:
<select id="country" name="country" onchange="return this.getForm().sendRequest(
'shop:on_updateStateList',
{extraFields: {
'country': $(this).get('value'),
'control_name': 'state',
'control_id': 'state',
'current_state': '<?= $shipping_info->state ?>'},
update: {'shipping_states': 'shop:state_selector'}
})">
To make the state list updatable, place it into a separate partial. In the code example above the partial is called
shop:state_selector.
The parameters control_name, control_id, current_state are passed into the state list partial by LemonStand when it handles
the shop:on_updateStateList request. You can use these parameters in the state list partial highlighting a currently selected state.
Specifies the state selector element name. Required.
Specifies the state selector element identifier. Required.
Specifies the state selector element name.
Specifies the state selector element identifier.