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
trueif the country is popular for this shop. Otherwise, returnsfalse. This can be useful for sorting countries in a country selector.
Example
{
"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.
Code
{% for country in localization.available_countries -%}
{{ country }}
{%- endfor %}Data
{
"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
Output
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 StatesRendering 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.
Code
{{ localization.country | image_url: width: 32 | image_tag }}Data
{
"localization": {
"country": "Canada"
}
}Output
Output
<img src="//cdn.shopify.com/static/images/flags/ca.svg?width=32" alt="Canada" srcset="//cdn.shopify.com/static/images/flags/ca.svg?width=32 32w" width="32" height="24">