translate and adapt - geolocation

translate and adapt - geolocation

ddcu
Excursionist
43 0 2

hello,

 

I am  trying to set up english langauge as default on my european markets while on my primary market denmark keep Danish as default.

However, when testing it with VPN it by default shows Danish to all customers regardless of their location in Europe. Anyone knows what i need to adjust?

On Europe market I use subfolders (domain suffix)

The url is. www.cungx.dk 

Reply 1 (1)

DaisyVo
Shopify Partner
4469 501 598

Hi @ddcu 

I see what you’re trying to do—keeping Danish as the default for Denmark while ensuring English is the default for your other European markets. Right now, it sounds like your store is automatically showing Danish to all visitors, no matter where they’re browsing from. This is likely happening because of how Shopify handles language detection and redirection. Let’s get that fixed!

What’s Happening?

Since you’re using subfolders (domain suffixes) for your European markets, Shopify should be able to serve different languages based on the user’s region. However, by default, Shopify often prioritizes the primary store language or the user’s browser settings instead of geolocation alone.

How to Fix It:

1. Check Your Language Settings in Shopify Markets

  • Go to Settings > Markets
  • Click on your European Market
  • Under Domains and languages, make sure English is set as the default language for all European countries (except Denmark).
  • In your Primary Market (Denmark), ensure Danish is selected as default.

2. Enable Language Redirection (if needed)

  • Go to Settings > Languages
  • Check if automatic redirection based on location is enabled.
  • If it’s on but still not working, it could be overriding the settings due to how Shopify prioritizes language detection.

3. Force Language Selection via URL

Since you’re using subfolders, Shopify allows users to access the right language directly through URLs. Try these:

If VPN tests always show Danish, try opening www.cungx.dk/en directly to see if it sticks. If not, something might be forcing Danish as the default.

4. Use a Custom Redirect Script (If Needed)

If Shopify’s built-in settings don’t work, you can add a simple script in your theme.liquid file to force language selection based on geolocation. Shopify provides a window.navigator.language method that detects the user’s browser language and redirects accordingly.

Here’s an example of how you can apply it:

 

<script>

document.addEventListener("DOMContentLoaded", function () {

    var userLang = navigator.language || navigator.userLanguage; // Detects browser language

    if (userLang.startsWith("da")) {

        window.location.href = "https://www.cungx.dk/da"; // Redirects Danish users

    } else {

        window.location.href = "https://www.cungx.dk/en"; // Redirects everyone else to English

    }

});

</script>

 

🔹 Where to add it?

  • Online Store > Themes > Edit Code
  • Open theme.liquid and paste this inside the <head> section

💡 Note: This works based on the browser language and not actual geolocation. If you need an advanced solution based on IP location, you might need a third-party app like Geolocation by Shopify or LangShop.

Final Check:

  • Test again with VPN (or incognito mode) to see if it works properly.
  • If it still shows Danish, clear your cookies/cache and try accessing www.cungx.dk/en directly.
  • If needed, Shopify support can also check if there's a conflict in your Markets setup.

Let me know if you need more help. Thanks!
Daisy.

Please let us know if our reply is helpful by giving it a Like or marking it as a Solution!

Avada SEO & Image Optimizer - The #1 SEO solution