Skip to main content

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

Anchor to
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, and South America.

The currency used in the country.

The ISO code of the country in ISO 3166-1 (alpha 2) format.

The market that includes this country.

The name of the country.

Returns true if the country is popular for this shop. Otherwise, returns false. This can be useful for sorting countries in a country selector.

Anchor to
unit_system
string from a set of values

The unit system of the country.

Possible values
imperial
metric
{
"available_languages": [],
"continent": "North America",
"currency": {},
"iso_code": "CA",
"market": {},
"name": "Canada",
"popular?": false,
"unit_system": "metric"
}
Anchor to Referencing the `country` object directly

Referencing the country object directly

When the country object is referenced directly, country.name is returned.

{% for country in localization.available_countries -%}
{{ country }}
{%- endfor %}

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 States
Anchor to Rendering a flag image

Rendering a flag image

When the country object is passed to the image_url 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 }}

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">
Was this section helpful?