Using country-specific address formats
There is no universally accepted address format. In nearly every country, the address format differs – in the US, the house number comes before the street name, in Denmark it’s opposite. In Hungary, the city or locality is written before the street name and number. In Ethiopia, the name of the building is written before the street and house number. Even if these differences seem small, they can play a significant role in whether or not a package makes it to the intended recipient.
To use country-specific address formats you can define frontend address formats on each ecommerce country. You can then use our api to fetch and render addresses using the approproate format – typically this will be in a shopping cart template.
In this example we do the following:
- Fetch the address format based on a country code. In this case we retrieve it from the Customer.Country.Code property of an on order object
- Run through the address format list and replace each placeholder with a property from the order object
- Render the formatted address