How to add country flags to your country/region selector (Shopify Guide 2023)

Free Shopify Guides

Comparison image of before vs after adding country flags to region selector

In this Shopify guide, I've prepared all the code you need to display country flags in your currency and region selector. It's a popular way to enhance your store for the international market.

It's a copy/paste guide for the non-technical person. I use Dawn theme version 9.0.0 in this guide but the same steps work for almost all free themes in Shopify's theme store. Good luck!

Step 1: Add this code in country-localization.liquid

  • Go to "Edit Code" on your theme
  • In the top left corner search for "country-localization.liquid"
  • Go to row 8
  • Replace row 8 with below string of code so it looks like the following image

<div class="disclosure c-disclosure-country">

Add first string of code here

  • Go to row 16
  • Jump down to a new row
  • Copy and paste below code on the new row so it looks like the following image

{{ localization.country | image_url: width: 20 | image_tag }}
Add first string of code here
  • Go to row 35
  • Replace everything from row 35 to 39 with below code so it looks like the following image

<span class="localization-form__currency">
 {{ country | image_url: width: 20 | image_tag }}                 
 {{- country.currency.iso_code }}
 {{ country.currency.symbol }}
 {{ country.name | prepend: "| " }}
</span>
Add second string of code here
  • Save this file in the top right corner

Step 2: Add this code in component-localization-form.css

  • Stay in "Edit Code" on your theme
  • In the top left corner search for "component-localization-form.css"
  • Go to the bottom of this file
  • Jump down to a new row
  • Copy & paste below code so it looks like the following image

/* Customisations for country flags */

.c-disclosure-country .localization-form__select img,
.c-disclosure-country .disclosure__link img {
  border-radius: 4px;
  margin-right: 6px;
}

.c-disclosure-country .localization-form__select span,
.c-disclosure-country .localization-form__currency,
.c-disclosure-country .disclosure__link {
  display: inline-flex;
  align-items: center;
}

Add the code snippet for the basic styling

  • Save this file in the top right corner

Step 3: Confirm that it's working

  • Stay in edit code mode and click "Preview Store" in the top right corner (see below image)

Preview the changes we just made here

  • The country flag should now be visible in the country/region selector in your store as below images

Header with country flag applied in region selector

Footer with country flag applied in region selector

  • PS. Don't forget to enable the country/region selector in your theme customizer in the header and footer section.

Enable country and region selector in the theme customizer

Conclusion

This solution can vary if you got a custom design or theme. But it works on most free Shopify themes today if you want to add country flags to your country/region selector.

I do not recommend adding flags to your language selector. Since a flag represents a country, not a language. For example, you can speak Spanish, Chinese or English in many countries so a flag does not make any sense in that case.

Contact me below if you need help but I tried to keep it as easy as possible.

Thank you for reading! / J

Jesper Ahlbom

Hi! I'm Jesper Ahlbom

Shopify Developer Shopify Partner

In this blog, I've started to share free guides on very common requests I get from Shopify merchants since I started 2020.

About Free stuff Contact me for help

Leave a comment

Don't forget to mention which theme and version you got if you need help.

Please note, comments need to be approved before they are published.