Language changes back to default after setting correct localization

Language changes back to default after setting correct localization

Pixel-User
New Member
6 0 0

Hi!

 

When visiting my site for the first time, the language selector perfectly does its job and chooses Germany. But, as soon as I open a different site, e.g. imprint / contact and come back to the main page -> It resets language to default (English). Could cookies be the issue here? Even when I open the the main domain again like a new user, it does not localize anymore and you have to change it manually to German. 

 

This is also happening when I put something into the cart. As soon as I am getting forwarded. Language switches back to English and does not stay in German. 

 

Thanks for your support!

Replies 10 (10)

Dan-From-Ryviu
Shopify Partner
10766 2128 2248

Hi @Pixel-User 

What is your current location? Are you in Germany or the UK?

- Solved it? Hit Like and Accept solution! ❤️Buy Me Coffee❤️
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

Pixel-User
New Member
6 0 0

Hi, I am currently in Germany. And this happens in my browser as well as on my smartphone. 

richbrown_staff
Shopify Staff
652 96 169

Hi @Pixel-User , there's no link between IP location and language in Shopify so it's not that. Most often this happens because a link in your menu / navigation is hard coded, e.g. it's linking to www.example.com rather than in Online Store > Navigation selecting the homepage, if that makes sense. Rich

richbrown_staff_0-1702680918441.png

 

To learn more visit the Shopify Help Center or the Community Blog.

Pixel-User
New Member
6 0 0

Hi @richbrown_staff  
I think I understand a bit, but I don't know how to change this 🤔
I am currently not at home but will test this week. 

Could this also be related to the theme? Because the main problem or issue is, I load the page and it switches automatically to German but as soon as I click on the card, the checkout process is completely in English and I have to switch manually back to German. 

richbrown_staff
Shopify Staff
652 96 169

Hi @Pixel-User , I've looked at your store and I'm not sure how you've done this but there is a redirect somewhere in your store - if I click the logo it redirects to (yourwebsite.com)/products/sliibox?variant=47950846755151 - any idea how that would have got in there? 

To learn more visit the Shopify Help Center or the Community Blog.

Pixel-User
New Member
6 0 0

Hi @richbrown_staff 
Yes, my goal was to have on the very mainpage only one product, the main product. That's why I redirected it directly to the product. Do you think, that could the reason?

I got the tip from somewhere else and edited the theme code anywhere (I think it was in the header area to redirect directly to the product) so that it redirects not to the starting page, instead I wanted a solo product page. 

Hope this is understandable. 

 

P.S.: Sorry got the late reply. 

richbrown_staff
Shopify Staff
652 96 169

Hey @Pixel-User , this will be the reason, yes. I can't see where you're doing it in the code, but if it's redirecting to (yourwebsite.com)/products/sliibox?variant=47950846755151 then there is no locale subfolder, i.e. it is not redirecting to (yourwebsite.com)/de/products/sliibox?variant=47950846755151 so it'll be in English, not German.

 

There is not an easy way to set a product page as a homepage. Obviously it's entirely up to you how you build your store, but I would say it's uncommon. Perhaps featuring your product heavily on the homepage, making it easy to click into the product page, would be the way to go - as opposed to a redirect.

To learn more visit the Shopify Help Center or the Community Blog.

Pixel-User
New Member
6 0 0

Hi @richbrown_staff 
First of all, sorry for my late reply. The holidays and so on...

 

I think I found the changed code: 

I edited the code in the file "theme.liquid" and added the following code before the <head> tag: 

 

 

{%- if template contains 'index' -%}
<script>
window.location.href = '/products/sliibox';
</script>
{%- endif -%}

 

 

I think this was the issue, now it redirects (after removing this) again back to the main page. Now I have to change the look of it unfortunately as well 😞 

Thanks so much for your awesome support. So much appreciated and happy new year. 

 

Update: Now I got a different problem -> The page is in German, like sliibox.com/de but whenever I add something to the cart it goes to sliibox.com/cart -> which is the english version, why it is not switching / using the German translation, coming from the German main page. Any ideas for that? Thanks again

 

Update 2: Got it! Changed in the header.liquid from "/Cart" to "{{ routes.cart_url }}", found the solution in a different thread in your awesome support community. Thanks again. 

Pixel-User
New Member
6 0 0

My only problem left now is, that when the add to cart button is clicked (in German) it redirect to the page "/cart"

 

I changed it in "theme.min.js" to "{{ routes.cart_url }}" but this does not seem working within the .js-file, right? Any other ideaa how I could make it redirect the "add to cart" button to the "{{ routes.cart_url }}" page instead of "/cart"?

 

In the cart drawer and modal it is working by the way and this might be the workaround for this. But I prefer the redirect to be honest :/. 

 

 

dijivodigital
Visitor
2 0 0

My only problem left now is, that when the add to cart button is clicked (in German) it redirect to the page "/cart"

Hi, I'm having the same problem, how did you solve this problem? I would appreciate if you could help me.