📘 公式リファレンス📦 リファレンス/オブジェクト初級
theme オブジェクト
現在のテーマに関する情報(ID、名前、公開状態)にアクセスするオブジェクト。廃止予定のため新規実装は推奨されない。
用途
テーマのデバッグやログ出力で現在のテーマ ID を確認したいときに使用。実運用では REST Admin API での取得が推奨される。
設置場所
Liquid テンプレート内で `{{ theme.id }}`、`{{ theme.name }}`、`{{ theme.role }}` の形で参照できるが、廃止予定のため新しいコードでの使用は避ける。テーマエディタへのリンクが必要な場合は `/admin/themes/current/editor` を URL パスで指定する。
注意点
このオブジェクトは廃止予定(deprecated)のため、プロパティ値が変更される可能性があり、本番テーマで依存することは非推奨。テーマエディタリンクの生成やテーマ情報の取得は、REST Admin API の theme リソースを使用するか、管理画面で URL パス `/admin/themes/current/editor` を直指定する方が信頼性が高い。
仕様
87 行 / json{
"access": {
"global": true,
"parents": [],
"template": []
},
"deprecated": true,
"deprecation_reason": "Deprecated because the values of this object's properties are subject to change, so can't be relied on within the theme.\n\nIf you want to link to the theme editor for the published theme, then you can use the URL path `/admin/themes/current/editor`.\n\nWhile this object is deprecated in Liquid and shouldn't be used, you can still access it through the [REST Admin API](/api/admin-rest/current/resources/theme).",
"description": "",
"properties": [
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The ID of the theme.",
"name": "id"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The name of the theme.",
"name": "name"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "main",
"description": "The theme is published. Customers see it when they visit the online store.",
"array_value": ""
},
{
"type": "string",
"name": "unpublished",
"description": "The theme is unpublished. Customers can't see it.",
"array_value": ""
},
{
"type": "string",
"name": "demo",
"description": "The theme is installed on the store as a demo. The theme can't be published until the merchant buys the full version.",
"array_value": ""
},
{
"type": "string",
"name": "development",
"description": "The theme is used for development. The theme can't be published, and is temporary.",
"array_value": ""
}
],
"summary": "The role of the theme.",
"name": "role"
}
],
"summary": "Information about the current theme.",
"name": "theme",
"examples": [],
"json_data": {
"path": "/",
"handle": "theme",
"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> タグ内に埋め込む必須要素。
📁 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 行