Skip to content

address

Address management

Overview

k.commerce.address provides address-related operations for obtaining geographic information such as countries, provinces, and cities.

countries()

Get all country information.

Parameters: none.

ts
k.api.get(() => {
    const countries = k.commerce.address.countries()
    return { count: countries.length, items: countries.slice(0, 3) }
})

Return: Country[]

provinces()

Get list of provinces based on country name.

ts
k.api.get(() => {
    const provinces = k.commerce.address.provinces('China')
    return { count: provinces.length, items: provinces.slice(0, 3) }
})

parameter:

ParameterTypeRequiredDescription
countrystringyesCountry name (English)

Return: Province[]

cities()

Get a list of cities by country and province.

ts
k.api.get(() => {
    const cities = k.commerce.address.cities('China', 'Fujian')
    return { count: cities.length, items: cities.slice(0, 3) }
})

parameter:

ParameterTypeRequiredDescription
countrystringyesCountry name (English)
provincestringyesProvince name (English)

Return: City[]

structure

Country property

PropertyDescriptionType
codecountry codestring
nameCountry name (English)string
nameTranslationscountry name translationNameTranslation
currencycurrency codestring
currencySymbolcurrency symbolstring
emojiFlagflag emojistring

Province attribute

PropertyDescriptionType
countryCountry name (English)string
nameProvince name (English)string
nameTranslationsProvince name translationNameTranslation

City property

PropertyDescriptionType
countryCountry name (English)string
provinceProvince name (English)string
nameCity name (English)string
nameTranslationsCity name translationNameTranslation

NameTranslation Property

PropertyDescriptionType
keylanguage codestring
valueCorresponding translationstring