All things Shopify and commerce
Greetings, i use a third-party theme in my store and recently I added English as a second language, but although I have enabled the language switch option in the header of the theme the language switcher doesn't appear in the theme, both mobile and desktop. Does anyone know how I can fix that?
Thanks in advance!
Hi @mpatsia
Please check this code
<div class="disclosure">
<button
type="button"
class="disclosure__button localization-form__select localization-selector link link--text caption-large"
aria-expanded="false"
aria-controls="{{ localPosition }}List"
aria-describedby="{{ localPosition }}Label"
>
<span>{{ localization.language.endonym_name | capitalize }}</span>
<svg aria-hidden="true" focusable="false" class="icon icon-caret" viewBox="0 0 10 6">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.354.646a.5.5 0 00-.708 0L5 4.293 1.354.646a.5.5 0 00-.708.708l4 4a.5.5 0 00.708 0l4-4a.5.5 0 000-.708z" fill="currentColor">
</svg>
</button>
<div class="disclosure__list-wrapper" hidden>
<ul id="{{ localPosition }}List" role="list" class="disclosure__list list-unstyled">
{%- for language in localization.available_languages -%}
<li class="disclosure__item" tabindex="-1">
<a
class="link link--text disclosure__link caption-large focus-inset"
href="#"
hreflang="{{ language.iso_code }}"
lang="{{ language.iso_code }}"
{% if language.iso_code == localization.language.iso_code %}
aria-current="true"
{% endif %}
data-value="{{ language.iso_code }}"
>
<span
{% if language.iso_code != localization.language.iso_code %}
class="visibility-hidden"
{% endif %}
>
<svg
class="icon icon-checkmark"
aria-hidden="true"
focusable="false"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 12 9"
fill="none"
>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.35.643a.5.5 0 01.006.707l-6.77 6.886a.5.5 0 01-.719-.006L.638 4.845a.5.5 0 11.724-.69l2.872 3.011 6.41-6.517a.5.5 0 01.707-.006h-.001z" fill="currentColor"/>
</svg>
</span>
<span>
{{ language.endonym_name | capitalize }}
</span>
</a>
</li>
{%- endfor -%}
</ul>
</div>
</div>
<input type="hidden" name="locale_code" value="{{ localization.language.iso_code }}">
It can work or require minimum modifications
Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
Thanks!
Hi, thanks for the replay, in which palce i must add this snippet of code?
Hi @mpatsia
You can put at the place where you want it, It may be header.liquid if you want to put there
OR
footer.liquid if you want to put in footer
You have to find the place that fit you
Thanks!
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By 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, 2024