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

taxonomy_category オブジェクト

商品に紐付けられた Google Taxonomy(商品分類)カテゴリ情報を取得するオブジェクト。カテゴリの ID、名前、階層構造にアクセスできる。

用途
商品詳細ページやコレクションで商品の分類情報を表示したり、階層的な親カテゴリを辿って販売カテゴリツリーを構築するときに使う。
設置場所
product.category で taxonomy_category オブジェクトにアクセスし、{{ product.category.name }} でカテゴリ名、{{ product.category.gid }} で Shopify GID を参照する。ancestors プロパティでループして親階層を走査できる。
注意点
Google Taxonomy は Shopify が管理する固定分類体系のため、新規カテゴリの追加や名前変更はできない。ancestors 配列は最上位の親から現在のカテゴリまでの全階層を含むため、深さを判定する場合は配列の長さをチェックする。product.category が未設定の商品では nil が返るので、条件分岐で存在確認が必要。
タグ:producttaxonomycategorygoogle-taxonomyhierarchy

仕様

94 行 / json
{
  "access": {
    "global": false,
    "parents": [
      {
        "object": "product",
        "property": "category"
      },
      {
        "object": "remote_product",
        "property": "category"
      }
    ],
    "template": []
  },
  "deprecated": false,
  "deprecation_reason": "",
  "description": "",
  "properties": [
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "string",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The public node ID for the category, formatted as a Shopify GID.",
      "name": "gid"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "string",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The public node ID for the category",
      "name": "id"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "string",
          "name": "",
          "description": "",
          "array_value": ""
        }
      ],
      "summary": "The localized category name",
      "name": "name"
    },
    {
      "deprecated": false,
      "deprecation_reason": "",
      "description": "",
      "examples": [],
      "return_type": [
        {
          "type": "array",
          "name": "",
          "description": "",
          "array_value": "taxonomy_category"
        }
      ],
      "summary": "All parent nodes of the current taxonomy category.",
      "name": "ancestors"
    }
  ],
  "summary": "The taxonomy category for a product",
  "name": "taxonomy_category",
  "examples": [],
  "json_data": {
    "path": "/products/health-potion",
    "handle": "product.category",
    "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