Skip to content

Instantly share code, notes, and snippets.

@lulessa
Created September 1, 2016 00:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lulessa/698d239180e220169e6fbc15f935c317 to your computer and use it in GitHub Desktop.
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)
{%- 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>
@lulessa
Copy link
Author

lulessa commented Sep 1, 2016

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' %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment