country
A country supported by the store's localization options.
To learn how to use the country
object to offer localization options in your theme,
refer to Support multiple currencies and languages.
Properties
- available_
languages array of shop_locale The languages that have been added to the market that this country belongs to.
The continent that the country is in.
Possible values are
Africa
,Asia
,Central America
,Europe
,North America
,Oceania
, andSouth America
.The ISO code of the country in ISO 3166-1 (alpha 2) format.
Returns
true
if the country is popular for this shop. Otherwise, returnsfalse
. This can be useful for sorting countries in a country selector.
{
"available_languages": [],
"continent": "North America",
"currency": {},
"iso_code": "CA",
"market": {},
"name": "Canada",
"popular?": false,
"unit_system": "metric"
}
Referencing the country
object directly
country
object directlyWhen the country object is referenced directly, country.name
is returned.
{% for country in localization.available_countries -%}
{{ country }}
{%- endfor %}
{
"localization": {
"available_countries": [
"Afghanistan",
"Australia",
"Austria",
"Belgium",
"Canada",
"Czechia",
"Denmark",
"Finland",
"France",
"Germany",
"Hong Kong SAR",
"Ireland",
"Israel",
"Italy",
"Japan",
"Malaysia",
"Netherlands",
"New Zealand",
"Norway",
"Poland",
"Portugal",
"Singapore",
"South Korea",
"Spain",
"Sweden",
"Switzerland",
"United Arab Emirates",
"United Kingdom",
"United States"
]
}
}
Output
Rendering a flag image
When the country object is passed to the filter, a CDN URL for that country’s flag is returned. All country’s flags are SVGs, normalized to an aspect ratio of 4:3.
{{ localization.country | image_url: width: 32 | image_tag }}
{
"localization": {
"country": "Canada"
}
}