Liquid Snippets by ALSEL
📘 公式リファレンス📦 リファレンス/オブジェクト初級

metaobject_system オブジェクト

メタオブジェクトの基本情報(型、ハンドル、ID、URL)にアクセスするシステムプロパティ。ユーザー定義フィールドとの名前衝突を避けるため、これらのプロパティは `system` オブジェクト配下にまとめられている。

用途
メタオブジェクトをループで処理するときに型で条件分岐したり、メタオブジェクトの一意な ID やハンドルを取得して内部リンク URL を生成するシーンで使う。
設置場所
Liquid 内で `{{ metaobject.system.type }}` や `{{ metaobject.system.handle }}` の形で参照する。metaobjects.テーブル名["ハンドル"].system.プロパティの構文でダイレクトアクセスも可能。
注意点
url プロパティはメタオブジェクト定義に `online_store` ケーパビリティが有効な場合にのみセットされ、未設定の場合は `nil` となる。type と handle は作成時に確定し、後から変更できないため、複数の型が混在するメタオブジェクトリストを処理するときは type で型判定して適切なレンダリングロジックを分岐させる。
タグ:metaobjectsystemreferencehandlemetadata

仕様

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": []
}

出典・ライセンス

License:
MIT

このコードは Shopify 著作の MIT ライセンスソースです。 原本の著作権は Shopify が保有します。日本語訳は ALSEL によるものです。

関連項目

📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_header オブジェクト

Shopify が必要とするスクリプト(分析・チェックアウト・言語設定など)をすべて動的に出力するオブジェクト。theme.liquid の <head> タグ内に埋め込む必須要素。

📁 theme-liquid-docs·MIT·20
📘 公式リファレンス📦 リファレンス/オブジェクト中級

metaobjects オブジェクト

ストア全体のメタオブジェクト定義にアクセスするグローバルオブジェクト。個別のメタオブジェクトはタイプとハンドルで参照でき、メタオブジェクト定義のエントリをループで反復処理できる。

📁 theme-liquid-docs·MIT·20
📘 公式リファレンス📦 リファレンス/オブジェクト初級

additional_checkout_buttons オブジェクト

PayPal Express Checkout など、オフサイト決済に対応した外部決済プロバイダーがストアに設定されているかを真偽値で返す。`content_for_additional_checkout_buttons` と組み合わせて、該当するチェックアウトボタンを条件付きで表示する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

canonical_url オブジェクト

現在のページの正規 URL を取得するオブジェクト。Google などの検索エンジンに対してどのページ版が正規であるかを指定するために使用する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_index オブジェクト

ホームページに表示するセクションの内容を動的に返すオブジェクト。Liquid インデックステンプレートで必ず使用する。

📁 theme-liquid-docs·MIT·27
📘 公式リファレンス📦 リファレンス/オブジェクト初級

content_for_additional_checkout_buttons オブジェクト

PayPal、Apple Pay、Google Pay など複数の決済プロバイダが有効になっているとき、その決済ボタンを HTML として出力するオブジェクト。`additional_checkout_buttons` で有無を判定したうえで、このオブジェクトで実際のボタンを表示する。

📁 theme-liquid-docs·MIT·27