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

Topic summary

Prestigeテーマを使用しているオンラインストアで、特定のロケーション(アメリカ)からアクセスした場合のみ通貨セレクターを非表示にする方法についての質問。

質問内容:

  • 通貨セレクターと言語セレクターの表示/非表示はカスタム設定で可能
  • アメリカからのアクセス時のみ通貨セレクターを非表示にしたい
  • footer.liquidへの追記で実現可能か

解決策:
回答者が以下のコードを提案:

  • {%- if show_country_selector or show_locale_selector -%} の配下に条件分岐を挿入
  • アメリカ(ISO国コード ‘US’)の場合に show_country_selectorfalse に設定するコード

結果:
質問者が解決策を実装し、問題が解決された。

Summarized with AI on November 12. AI used: claude-sonnet-4-5-20250929.

質問です。

テーマは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

ありがとうございます!

助かりました。

実装してみます。