📘 公式リファレンス📦 リファレンス/オブジェクト中級
gift_card オブジェクト
ギフトカードの残高、コード、有効期限、受取人情報などを参照するオブジェクト。ギフトカード受け取り後のお礼ページで使用する。
用途
ギフトカード購入完了後に表示される gift_card.liquid テンプレートで、顧客がギフトカードのコード、残高、有効期限を確認できる画面を構築するとき。
設置場所
gift_card.liquid テンプレート内で、`{{ gift_card.balance | money }}` や `{{ gift_card.code }}` のようにプロパティを直接参照する。ギフトカード専用テンプレートのため、他のテンプレートでは利用できない。
注意点
balance と initial_value は通貨のサブユニット単位で出力され、JPY・KRW など補助通貨を持たない場合は 100 倍の値が返される(例:1,000 円は 100,000)。money フィルターで正しい形式に整形する必要がある。expires_on が nil の場合はギフトカードが無期限であることを示し、date フィルターで日付をフォーマットする前に nil チェックを入れる。recipient が nil の場合、ギフトカードが関連する受取人を持たないため、条件分岐で message と recipient の表示を制御する。
仕様
327 行 / json{
"access": {
"global": false,
"parents": [],
"template": [
"gift_card.liquid"
]
},
"deprecated": false,
"deprecation_reason": "",
"description": "",
"properties": [
{
"deprecated": false,
"deprecation_reason": "",
"description": "The value is output in the customer's local (presentment) currency.\n\nFor currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.\n\n> Tip:\n> Use [money filters](/docs/api/liquid/filters/money-filters) to output a formatted amount.",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The remaining balance of the gift card in the currency's subunit.",
"name": "balance"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The code used to redeem the gift card.",
"name": "code"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The [ISO code](https://www.iso.org/iso-4217-currency-codes.html) of the currency that the gift card was issued in.",
"name": "currency"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "customer",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The customer associated with the gift card.",
"name": "customer"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "If there is no recipient associated with the gift card, then `nil` is returned.",
"examples": [],
"return_type": [
{
"type": "recipient",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The recipient associated with the gift card.",
"name": "recipient"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "If there is no message intended for the recipient, then `nil` is returned.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The personalized message intended for the recipient.",
"name": "message"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "If the gift card does not have a scheduled date, then `nil` is returned.\n> Tip:\n> Use the [`date` filter](/docs/api/liquid/filters/date) to format the date.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The scheduled date on which the gift card will be sent to the recipient.",
"name": "send_on"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "boolean",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Returns `true` if the gift card is enabled. Returns `false` if not.",
"name": "enabled"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "boolean",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Returns `true` if the gift card is expired. Returns `false` if not.",
"name": "expired"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "If the gift card never expires, then `nil` is returned.\n> Tip:\n> Use the [`date` filter](/docs/api/liquid/filters/date) to format the timestamp.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "A timestamp for when the gift card expires.",
"name": "expires_on"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "The value is output in the customer's local (presentment) currency.\n\nFor currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.\n\n> Tip:\n> Use [money filters](/docs/api/liquid/filters/money-filters) to output a formatted amount.",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The initial balance of the gift card in the currency's subunit.",
"name": "initial_value"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Tip:\n> The page at this URL is rendered through the [`gift_card.liquid` template](/themes/architecture/templates/gift-card-liquid)\n> of the theme.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The URL to view the gift card. This URL is on the `checkout.shopify.com` domain.",
"name": "url"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "The name doesn't include the `gift_card.` prefix, or the `.liquid` file extension.\n\n If a custom template isn't assigned to the gift card, then `nil` is returned.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The name of the [custom template](/themes/architecture/templates#alternate-templates) assigned to the gift card.",
"name": "template_suffix"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "If there aren't any line item properties, then an [`EmptyDrop`](/docs/api/liquid/basics#emptydrop) is returned.",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "untyped"
}
],
"summary": "The [line item properties](/docs/api/liquid/objects/line_item#line_item-properties) assigned to the gift card.",
"name": "properties"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "A string used to generate a QR code for the gift card.",
"name": "qr_identifier"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The URL to download the gift card as an Apple Wallet Pass.",
"name": "pass_url"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "product",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The product associated with the gift card.",
"name": "product"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "If there is no variant associated with the gift card, then `nil` is returned.",
"examples": [],
"return_type": [
{
"type": "variant",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The variant associated with the gift card.",
"name": "variant"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The last 4 characters of the code used to redeem the gift card.",
"name": "last_four_characters"
}
],
"summary": "A [gift card](https://help.shopify.com/manual/products/gift-card-products) that's been issued to a customer or a recipient.",
"name": "gift_card",
"examples": [],
"json_data": {
"path": "",
"handle": "",
"data_from_file": "{\"balance\":5000,\"code\":\"WCGX 7X97 K9HJ DFR8\",\"currency\":\"CAD\",\"customer\":{},\"enabled\":true,\"expired\":false,\"expires_on\":null,\"initial_value\":5000,\"last_four_characters\":\"DFR8\",\"message\":null,\"send_on\":null,\"pass_url\":\"https://polinas-potent-potions.myshopify.com/v1/passes/pass.com.shopify.giftcardnext/94af7fbe55d010130df8d8bc4a338d36/\",\"product\":{},\"variant\":{},\"properties\":{},\"qr_identifier\":\"shopify-giftcard-v1-3TKWJKJBM3X7PBRK\",\"recipient\":null,\"template_suffix\":null,\"url\":\"https://checkout.shopify.com/gift_cards/56174706753/0011c591fc720d0a51b80cdb694f969e\"}"
},
"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 行