filter オブジェクト
コレクションページや検索結果ページで利用可能なフィルター(絞り込み)の情報を表すオブジェクト。フィルターの種類、ラベル、選択値、URL パラメータなどにアクセスできる。
仕様
284 行 / json{
"access": {
"global": false,
"parents": [
{
"object": "collection",
"property": "filters"
},
{
"object": "search",
"property": "filters"
}
],
"template": []
},
"deprecated": false,
"deprecation_reason": "",
"description": "To learn about supporting filters in your theme, refer to [Support storefront filtering](/themes/navigation-search/filtering/storefront-filtering/support-storefront-filtering).",
"properties": [
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The URL parameter for the filter. For example, `filter.v.option.color`.",
"name": "param_name"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The customer-facing label for the filter.",
"name": "label"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "Example:\nFor a filter named `color` with values `red` and `blue`:\n - If the operator is `AND`, it will filter items that are both red and blue.\n - If the operator is `OR`, it will filter items that are either red or blue or both.\n\nFilters that support the `AND` operator:\n - Product tags\n - Metafields of type `list.single_line_text_field` and `list.metaobject_reference`",
"examples": [],
"return_type": [
{
"type": "string",
"name": "AND",
"description": "Includes products that match all buyer selections.",
"array_value": ""
},
{
"type": "string",
"name": "OR",
"description": "Includes products that match at least one buyer selection.",
"array_value": ""
}
],
"summary": "The logical operator used by the filter.\nReturns a value only for `boolean` and `list` type filters. Returns `nil` for other types.",
"name": "operator"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "boolean",
"description": "",
"array_value": ""
},
{
"type": "string",
"name": "list",
"description": "",
"array_value": ""
},
{
"type": "string",
"name": "price_range",
"description": "",
"array_value": ""
}
],
"summary": "The type of the filter.",
"name": "type"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "filter_value"
}
],
"summary": "The values of the filter that are currently active.\n\nThe array can have values only for `boolean` and `list` type filters.",
"name": "active_values"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "The array can have values only for `boolean` and `list` type filters.",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "filter_value"
}
],
"summary": "The values of the filter that are currently inactive.",
"name": "inactive_values"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "filter_value"
}
],
"summary": "The values of the filter.\n\nThe array can have values only for `boolean` and `list` type filters.",
"name": "values"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "filter_value",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The `false` filter value.\n\nReturns a value for `boolean` type filters if the unfiltered view has at least one result with the `false` filter value. Otherwise, it returns `nil`.",
"name": "false_value"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "filter_value",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The `true` filter value.\n\nReturns a value for `boolean` type filters if the unfiltered view has at least one result with the `true` filter value. Otherwise, it returns `nil`.",
"name": "true_value"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "filter_value",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The highest filter value.\n\nReturns a value only for `price_range` type filters. Returns `nil` for other types.",
"name": "max_value"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "filter_value",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The lowest filter value.\n\nReturns a value only for `price_range` type filters. Returns `nil` for other types.",
"name": "min_value"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The highest product price within the collection or search results.\n\nReturns a value only for `price_range` type filters. Returns `nil` for other types.",
"name": "range_max"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The current page URL with the URL parameter related to the filter removed.",
"name": "url_to_remove"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "image",
"description": "",
"array_value": ""
},
{
"type": "string",
"name": "swatch",
"description": "",
"array_value": ""
},
{
"type": "string",
"name": "text",
"description": "",
"array_value": ""
}
],
"summary": "Describes how to present the filter values.\n\nReturns a value only for `list` type filters. Returns `nil` for other types.",
"name": "presentation"
}
],
"summary": "A [storefront filter](https://help.shopify.com/manual/online-store/themes/customizing-themes/storefront-filters).",
"name": "filter",
"examples": [],
"json_data": {
"path": "/search?q=potion&filter.v.option.strength=Low",
"handle": "search.filters.to_a[3]",
"data_from_file": ""
},
"return_type": []
}出典・ライセンス
- Repository:
- https://github.com/Shopify/theme-liquid-docs
- License:
- MIT
このコードは Shopify 著作の MIT ライセンスソースです。 原本の著作権は Shopify が保有します。日本語訳は ALSEL によるものです。
関連項目
content_for_header オブジェクト
Shopify が必要とするスクリプト(分析・チェックアウト・言語設定など)をすべて動的に出力するオブジェクト。theme.liquid の <head> タグ内に埋め込む必須要素。
metaobjects オブジェクト
ストア全体のメタオブジェクト定義にアクセスするグローバルオブジェクト。個別のメタオブジェクトはタイプとハンドルで参照でき、メタオブジェクト定義のエントリをループで反復処理できる。
additional_checkout_buttons オブジェクト
PayPal Express Checkout など、オフサイト決済に対応した外部決済プロバイダーがストアに設定されているかを真偽値で返す。`content_for_additional_checkout_buttons` と組み合わせて、該当するチェックアウトボタンを条件付きで表示する。
canonical_url オブジェクト
現在のページの正規 URL を取得するオブジェクト。Google などの検索エンジンに対してどのページ版が正規であるかを指定するために使用する。
content_for_index オブジェクト
ホームページに表示するセクションの内容を動的に返すオブジェクト。Liquid インデックステンプレートで必ず使用する。
content_for_additional_checkout_buttons オブジェクト
PayPal、Apple Pay、Google Pay など複数の決済プロバイダが有効になっているとき、その決済ボタンを HTML として出力するオブジェクト。`additional_checkout_buttons` で有無を判定したうえで、このオブジェクトで実際のボタンを表示する。