Hiding theme sections / navigation links based on language

Solved

Hiding theme sections / navigation links based on language

antonvivaldi
Visitor
2 1 1

Hello!

 

We are planning to expand our store to new markets with separate warehouses which makes some of the existing content on the website redundant for these markets. 

 

I'd need advice on the best way to hide sections / navigation elements on our website when a customer is browsing in a certain language, in this case Norwegian. 

 

I've done some initial research and tried this app (https://apps.shopify.com/advanced-geo-functions) yesterday but it didn't seem to offer all the functionalities I need. Additionally it stopped our slider from loading normally.

 

I've understood that it's somehow possible to use the following logic to hide content in Norwegian:

 

{% if localization.country.iso_code == 'NO' %}

{% else %}

{% endif %}

 

But I suck at code (other than html, css) and don't know where I should apply this code. We use Venue theme and the page templates are in .json.

 

Any advice would be highly appreciated! Thanks!

Accepted Solution (1)

antonvivaldi
Visitor
2 1 1

This is an accepted solution.

@saim007 Thank you for your suggestion and for your time. I think that option is slightly too complicated for our case. 

 

I tried again with Advanced Store Localization plugin and managed to get it to work the way it should. It's not the easiest plugin to use but if anybody finds themselves in a similar situation as me, I'd recommend giving it a try.

View solution in original post

Replies 4 (4)

saim007
Shopify Partner
602 74 102

Hello @antonvivaldi If you want to hide section or navigation for the one country only in your case Norway then use if else condition like below - 

{% if localization.country.iso_code == 'NO' %}
{% header-norway.liquid %}
{% else %}
{% header.liquid %}
{% endif %}

The above code will show different header if customer from the Norway see this header and if not from Norway will see another header, this is just for an example.

 

But if you have multiple countries and want to show content for them then you should use case condition like below code - 

{% case localization.country_iso_code %}
 {% when "NO" %}
{% section 'header-no' %}
 {% when "US" %}
{% section 'header-us' %}
 {% when "NZ" %}
{% section 'header-nz' %}
 {% when "CA" %}
{% section 'header-ca' %}
{% endcase %}

 You have to put the code in theme.liquid file for working. you can change condition as per your requirement.

Saim | Shopify Partner Expert

Was I helpful?

Buy me a Coffee

🙂
Hire me   to unlock the full potential of your e-commerce store 🙂

antonvivaldi
Visitor
2 1 1

This is an accepted solution.

@saim007 Thank you for your suggestion and for your time. I think that option is slightly too complicated for our case. 

 

I tried again with Advanced Store Localization plugin and managed to get it to work the way it should. It's not the easiest plugin to use but if anybody finds themselves in a similar situation as me, I'd recommend giving it a try.

kareem85
New Member
5 0 0

Hello @antonvivaldi , can you please share which plugin have you used to resolve this issue ?

topnewyork
Globetrotter
633 113 134

Hi @antonvivaldi , kindly checkout the below videos.

If my reply is helpful, kindly click like and mark it as an accepted solution.

Thanks!

Need a Shopify developer?
Hire us at Top New York Web Design
For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
Subscribe to our youtube channel