metaobject_system オブジェクト
メタオブジェクトの基本情報(型、ハンドル、ID、URL)にアクセスするシステムプロパティ。ユーザー定義フィールドとの名前衝突を避けるため、これらのプロパティは `system` オブジェクト配下にまとめられている。
仕様
101 行 / json{
"access": {
"global": false,
"parents": [
{
"object": "metaobject",
"property": "system"
}
],
"template": []
},
"deprecated": false,
"deprecation_reason": "",
"description": "",
"properties": [
{
"deprecated": false,
"deprecation_reason": "",
"description": "This is a free-form string that's defined when the metaobject definition is created.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The type of the metaobject definition.",
"name": "type"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The unique [handle](/api/liquid/basics#handles) of the metaobject.",
"name": "handle"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The ID of the metaobject.",
"name": "id"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "Only set for metaobjects that have the `online_store` capability.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The relative URL of the metaobject.",
"name": "url"
}
],
"summary": "Basic information about a [`metaobject`](/api/liquid/objects#metaobject). These properties are grouped under the `system` object to avoid collisions between system property names and user-defined metaobject fields.",
"name": "metaobject_system",
"examples": [
{
"name": "Using the `metaobject_system` object",
"description": "You can access the `metaobject_system` object and its properties through the metaobject's `system` property. You can use the following syntax:\n\n```liquid\n{{ metaobjects.testimonials[\"home_page\"].system.id }}\n```\n\nYou can also access `metaobject_system` properties when iterating over a list of metaobjects:\n\n```liquid\n{% for metaobject in product.metafields.custom.mixed_metaobject_list.value %}\n {% if metaobject.system.type == \"testimonial\" %}\n {% render 'testimonial' with metaobject as testimonial %}\n {% else %}\n {{ metaobject.system.handle }}\n {% endif %}\n{% endfor %}\n```\n",
"syntax": "",
"path": "",
"raw_liquid": "",
"parameter": false,
"display_type": "text",
"show_data_tab": false
}
],
"json_data": {
"path": "",
"handle": "",
"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` で有無を判定したうえで、このオブジェクトで実際のボタンを表示する。