📘 公式リファレンス🔧 リファレンス/フィルター初級
currency_selector フィルター(通貨選択)
ストアで利用可能なすべての通貨をオプションとして持つ HTML select 要素を生成するフィルター。form オブジェクトに適用して使用する。
用途
ストア上で複数通貨に対応するとき、ヘッダーやフッターに通貨選択ドロップダウンを配置してユーザーが通貨を切り替えられるようにする。
設置場所
currency form タグ内で `{{ form | currency_selector }}` の形で使用する。class や id パラメータで select 要素のスタイリングに対応できる。
注意点
このフィルターは廃止予定(deprecated)であり、Shopify では localization form タグを使った国・言語選択への移行を推奨している。代わりに Shopify の公式ドキュメント「複数通貨・言語セレクターの実装」を参照して localization form に書き換えることが望ましい。
仕様
69 行 / json{
"category": "localization",
"deprecated": true,
"deprecation_reason": "Deprecated without a direct replacement because the [currency form](/docs/api/liquid/tags/form#form-currency) has also been\ndeprecated. The currency form was replaced by the [localization form](/docs/api/liquid/tags/form#form-localization). Refer to\nthis guide which explains [how to create a country selector](/docs/themes/markets/multiple-currencies-languages#implementing-country-and-language-selectors)\nusing the localization form.",
"description": "The `currency_selector` filter must be applied to the [`form` object](/docs/api/liquid/objects/form) within a\n[currency form](/docs/api/liquid/tags/form#form-currency).",
"parameters": [
{
"description": "The desired `class` attribute.",
"name": "class",
"positional": false,
"required": false,
"types": [
"string"
]
},
{
"description": "The desired `id` attribute.",
"name": "id",
"positional": false,
"required": false,
"types": [
"string"
]
}
],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"examples": [
{
"name": "",
"description": "",
"syntax": "",
"path": "/",
"raw_liquid": "{% form 'currency' %}\n {{ form | currency_selector }}\n{% endform %}",
"parameter": false,
"display_type": "text",
"show_data_tab": true
},
{
"name": "class",
"description": "Specify the `class` attribute of the `<select>` element.",
"syntax": "form | currency_selector: class: string",
"path": "/",
"raw_liquid": "{% form 'currency' %}\n {{ form | currency_selector: class: 'custom-class' }}\n{% endform %}",
"parameter": true,
"display_type": "text",
"show_data_tab": true
},
{
"name": "id",
"description": "Specify the `id` attribute of the `<select>` element.",
"syntax": "form | currency_selector: id: string",
"path": "/",
"raw_liquid": "{% form 'currency' %}\n {{ form | currency_selector: id: 'custom-id' }}\n{% endform %}",
"parameter": true,
"display_type": "text",
"show_data_tab": true
}
],
"summary": "Generates an HTML `<select>` element with an option for each currency available on the store.",
"syntax": "form | currency_selector",
"name": "currency_selector"
}出典・ライセンス
- Repository:
- https://github.com/Shopify/theme-liquid-docs
- License:
- MIT
このコードは Shopify 著作の MIT ライセンスソースです。 原本の著作権は Shopify が保有します。日本語訳は ALSEL によるものです。
関連項目
📘 公式リファレンス🔧 リファレンス/フィルター初級
avatar フィルター(顧客アバター画像HTML生成)
顧客アバターが存在する場合、それを表示する HTML タグを生成するフィルター。customer オブジェクトに対して使用する。
📁 theme-liquid-docs·MIT·19 行
📘 公式リファレンス🔧 リファレンス/フィルター初級
default_errors フィルター(フォーム送信エラーを日本語化)
form.errors の各エラーコードに対応する既定のエラーメッセージを自動生成するフィルター。フォーム送信時の入力値不正や必須項目空白などのエラーを言語別に出力する。
📁 theme-liquid-docs·MIT·19 行
📘 公式リファレンス🔧 リファレンス/フィルター初級
date フィルター(日付を指定形式でフォーマット)
日付値を指定されたフォーマット文字列に従って整形する。フォーマット文字列が空の場合は元の値がそのまま返される。入力が日付に変換できない場合も元の値が返される。
📁 theme-liquid-docs·MIT·19 行
📘 公式リファレンス🔧 リファレンス/フィルター初級
payment_terms フィルター(Shop Pay分割払いバナーを生成)
product フォームまたは cart フォームに対して使用し、Shop Pay の分割払いオプションを表示するための HTML を生成するフィルター。顧客が購入時に分割払いプランを選択できるようにする。
📁 theme-liquid-docs·MIT·19 行
📘 公式リファレンス🔧 リファレンス/フィルター初級
abs フィルター(数値の絶対値を取得)
負の数を正の数に変換する。数値の絶対値(ゼロからの距離)を返すフィルター。
📁 theme-liquid-docs·MIT·30 行
📘 公式リファレンス🔧 リファレンス/フィルター初級
append フィルター(文字列の末尾に追加)
文字列の末尾に別の文字列を連結するフィルター。URL パスの結合やテキストの接尾辞追加に使う。
📁 theme-liquid-docs·MIT·30 行