craftcms / docs

Documentation for Craft CMS, Craft Commerce, and other official products.
https://craftcms.com/docs
38 stars 144 forks source link

[Content]: Get info about single country from country repository #615

Open AugustMiller opened 3 weeks ago

AugustMiller commented 3 weeks ago

Product

Other/Multiple/Not Sure

Description

When you have access to an address, it's not straightforward how you'd display the country’s name:

{% set country = craft.app.addresses.getCountryRepository().get(address.countryCode) %}

{# `country` is now a `CommerceGuys\Addressing\Country\Country` object: #}
{{ country.name }}
{{ country.currency_code }}
AugustMiller commented 2 weeks ago

This might just be worth a PR for Commerce?