Skip to content

[5.x]: Add option to output country name in addition to country code in Craft CMS #15455

@alexanderbuergin

Description

@alexanderbuergin

Description:

Currently, the Country Field in Craft CMS only allows for the country code to be output, for example, "AT" for Austria. It would be beneficial to have an option to output the country name, such as "Austria", similar to how other select fields operate, where you can output different values in the template.

In the same vein, it would be practical to extend this option to the country field in the normal address fields as well.

Proposal:

The implementation could look as follows:

entry.country -> entry.country.code (default)
entry.country.name
entry.country.code

The values would be based on the ISO-3166-1 coding list.

This enhancement would significantly improve the usability and flexibility of the Country Field in Craft CMS.

Feel free to modify it further if needed.

Craft CMS version

5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions