Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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!
Solved! Go to the solution
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.
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.
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.
Hello @antonvivaldi , can you please share which plugin have you used to resolve this issue ?
Hi @antonvivaldi , kindly checkout the below videos.
If my reply is helpful, kindly click like and mark it as an accepted solution.
Thanks!
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024