by Firecheckout Support

How to modify the address format?

Advanced Address Formatting option is available at Stores - Configuration - Swissup Checkout - Address Autocomplete - Advanced Formatting.

Note: when enabling “Advanced Formatting”, the common Address Formatting options are overridden and not working.

Field Format

The following JSON format is used:

{
    "*": {
        "FIELD_NAME1": "PLACEHOLDER1",
        "FIELD_NAME2": "PLACEHOLDER2"
    },
    "COUNTRY_CODE1": {
        "FIELD_NAME1": "PLACEHOLDER3"
    },
    "COUNTRY_CODE2": {
        "FIELD_NAME1": "PLACEHOLDER4"
    }
}
  • * field - Fallback settings will be used if the currently selected country is not found in the list.
  • COUNTRY_CODE - Officially assigned ISO 3166-1 alpha-2 country code. Example: US, ES, AU
  • FIELD_NAME - One of the supported field names
  • PLACEHOLDER - Combination of supported tokens

Note: ‘*’ settings are not completely overridden with “COUNTRY_CODE” related options, but they are merged into a single object. For example, when “COUNTRY_CODE1” is selected, “FIELD_NAME1” will use “PLACEHOLDER3” and “FIELD_NAME2” will use “PLACEHOLDER2”.

Field Names and Default Placeholders

  • Field street1 - Default Placeholder "{{street_number.short_name}}{{ }}{{route.long_name}}{{, }}{{subpremise.short_name}}"
  • Field street2 - Default Placeholder ""
  • Field street3 - Default Placeholder ""
  • Field street4 - Default Placeholder ""
  • Field country_id - Default Placeholder "{{country.short_name}}"
  • Field city - Default Placeholder "{{postal_town.long_name|locality.long_name|administrative_area_level_2.long_name|sublocality_level_1.long_name}}"
  • Field postcode - Default Placeholder "{{postal_code.short_name}}{{-}}{{postal_code_suffix.short_name}}"
  • Field region - Default Placeholder "{{administrative_area_level_1.long_name}}"
  • Field region_code - Default Placeholder "{{administrative_area_level_1.short_name}}"

Available Tokens

Token

Description

Separator Used when two not empty tokens found around the separator
{{ }} space
{{, }} comma
{{ / }} slash
{{-}} dash
Custom Address Entities Entities returned by AddressAutocomplete module
{{subpremise.short_name}} Unit Number
Address Entities Entities returnes by Google Places API
{{route.long_name}} Street Name
{{street_number.short_name}} Street Number
{{country.short_name}} Country Code
{{postal_town.long_name|locality.long_name|administrative_area_level_2.long_name|sublocality_level_1.long_name}} City Name. Since Google API returns the city with a different names for different countries we use possible tokens combined with a ‘|’. This means that the first non-empty value will be used.
{{postal_code.short_name}} Postcode
{{postal_code_suffix.short_name}} Postcode Suffix
{{administrative_area_level_1.long_name}} Region Name
{{administrative_area_level_1.short_name}} Region Code

Examples

Default Value

Default value includes Unit Number Placement for Australian addresses and Neighbourhood Placement for Brazilian addresses:

{
    "*": {
        "country_id": "{{country.short_name}}",
        "street1": "{{street_number.short_name}}{{ }}{{route.long_name}}{{, }}{{subpremise.short_name}}",
        "street2": "",
        "street3": "",
        "street4": "",
        "city": "{{postal_town.long_name|locality.long_name|administrative_area_level_2.long_name|sublocality_level_1.long_name}}",
        "postcode": "{{postal_code.short_name}}{{-}}{{postal_code_suffix.short_name}}",
        "region": "{{administrative_area_level_1.long_name}}",
        "region_code": "{{administrative_area_level_1.short_name}}"
    },
    "AU": {
        "street1": "{{subpremise.short_name}}{{/}}{{street_number.short_name}}{{ }}{{route.long_name}}"
    },
    "BR": {
        "street4": "{{sublocality_level_1.long_name}}"
    }
}

Australian Unit Number Placement

{
    "AU": {
        "street1": "{{subpremise.short_name}}{{/}}{{street_number.short_name}}{{ }}{{route.long_name}}"
    }
}

Brazilian Neighbourhood Placement

{
    "BR": {
        "street4": "{{sublocality_level_1.long_name}}"
    }
}

Recent articles

up