特定のロケーションでの通貨セレクター非表示

質問です。

テーマはPrestigeを使用しています。

通貨セレクターと言語セレクターの表示、非表示はカスタムから行えますが、

特定のロケーション(アメリカ)からオンラインストアを見られた場合のみ通貨セレクターを非表示にできたらと考えております。

footer.liquidに追記したら可能でしょうか?

もし可能でしたら、サンプルコードをお教えいただけますと助かります。

ぜひお知恵をお貸しください。

何卒よろしくお願い致します。

[[セレクター部分のデフォルトのコード]]

{%- if section.settings.show_locale_selector and localization.available_languages.size > 1 -%}
{%- assign show_locale_selector = true -%}
{%- endif -%}

{%- if show_country_selector or show_locale_selector -%}

{%- if show_country_selector -%} {%- render 'localization-selector', type: 'country', placement: 'top-start', show_country_name: section.settings.show_country_name, show_country_flag: section.settings.show_country_flag -%} {%- endif -%}

{%- if show_locale_selector -%}
{%- render ‘localization-selector’, type: ‘locale’, placement: ‘top-start’ -%}
{%- endif -%}

{%- endif -%}

© {{ 'now' | date: '%Y' }} - {{ shop.name }}

{%- if section.settings.show_payment_icons and shop.enabled_payment_types.size > 0 -%}

{%- for type in shop.enabled_payment_types -%} {{- type | payment_type_svg_tag -}} {%- endfor -%}
{%- endif -%}

初めまして。

4行目の {%- if show_country_selector or show_locale_selector -%} の配下に下記コードを挿入すれば

実現可能かと思います。

{%- if localization.country.iso_code == 'US' -%}
  {%- assign show_country_selector = false -%}
{%- endif -%}

ご参考までに。

1 Like

ありがとうございます!

助かりました。

実装してみます。