Created
September 1, 2016 00:20
-
-
Save lulessa/698d239180e220169e6fbc15f935c317 to your computer and use it in GitHub Desktop.
Wishl wishlist Langify language switch implementation (for shops with more than one language)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- comment %} | |
Assign current language 2-letter code (e.g., en, fr, pt) | |
to language_code variable, then | |
use javascript to set Wishl app's language | |
{%- endcomment -%} | |
{%- assign language_code = shop.metafields.languages[language] -%} | |
{%- if shop.metafields.language_codes[language] -%} | |
{%- assign language_code = shop.metafields.language_codes[language] -%} | |
{%- endif -%} | |
<script type="text/javascript"> | |
window.wishl_set_lang_code = "{{ language_code | downcase }}"; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add a new snippet to your theme named wishl-langify-detect containing the code above.
Copy this code below and paste it in your theme's layout/theme.liquid file, just above the
</body>
tag:{% include 'wishl-langify-detect' %}