CartThrob 9 documentation for ExpressionEngine commerce teams Visit CartThrob.com
CartThrob.com

View Country Name

view_country_name converts a 3-letter (Alpha-3) country code to the full country name.

This tag performs a direct Alpha-3 lookup. If you need Alpha-2 support (US, CA, etc.), use convert_country_code instead.

See also:

Parameters

country_code

Three-letter country code used to look up and output the full country name.

Expected format: Alpha-3 (for example USA, CAN, GBR).

country_code="USA"

Behavior and Constraints

  1. This is an immediate-execution single tag.
  2. Lookup uses CartThrob locales country list (all_countries()), keyed by Alpha-3 code.
  3. If country_code is not an exact Alpha-3 match, output is empty.
  4. Missing country_code also returns empty output.

Examples

Basic usage:

{exp:cartthrob:view_country_name country_code="USA"}

With customer info:

{exp:cartthrob:customer_info}
    {exp:cartthrob:view_country_name country_code="{customer_country_code}"}
{/exp:cartthrob:customer_info}