Liquid, JavaScript, themes, sales channels
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.
@sandyparihar07 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.
@sandyparihar07 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 ?
User | RANK |
---|---|
37 | |
27 | |
14 | |
13 | |
9 |
Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023