📘 公式リファレンス📦 リファレンス/オブジェクト中級
discount_application オブジェクト
カートや注文に適用されているディスカウント(割引)の詳細情報を表すオブジェクト。割引額、種類、適用範囲などをストアのテーマで表示できる。
用途
カート画面や注文確認ページで、適用されているクーポンコード割引や自動割引の内容(割引額、割引率、割引名など)をカスタマイズして表示したいとき。
設置場所
`{{ cart.discount_applications }}` または `{{ order.discount_applications }}` でループして `{{ discount_application.title }}`、`{{ discount_application.total_allocated_amount | money }}` のようにプロパティを参照する。cart.liquid や order-status.liquid などのテンプレートで使用。
注意点
金額プロパティ(total_allocated_amount、value)は通貨の小数点単位で返されるため、金額フィルター(money フィルターなど)で整形して表示する。JPY や KRW など小数点がない通貨では、1000 円が 100000 として返されるので注意。割引適用範囲は target_selection(すべてか特定商品か)と target_type(商品か配送料か)の組み合わせで判定する。
仕様
188 行 / json{
"access": {
"global": false,
"parents": [
{
"object": "cart",
"property": "discount_applications"
},
{
"object": "order",
"property": "discount_applications"
},
{
"object": "discount_allocation",
"property": "discount_application"
}
],
"template": []
},
"deprecated": false,
"deprecation_reason": "",
"description": "To learn about how to display discounts in your theme, refer to [Discounts](/themes/pricing-payments/discounts).",
"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 total amount of the discount in the currency's subunit.",
"name": "total_allocated_amount"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The customer-facing name of the discount.",
"name": "title"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "How this value is interpreted depends on the [value type](/docs/api/liquid/objects/discount_application#discount_application-value_type) of the\ndiscount. The following table outlines what the value represents for each value type:\n\n| Value type | Value |\n| --- | --- |\n| `fixed_amount` | The amount of the discount in the currency's subunit. |\n| `percentage` | The percent amount of the discount. |\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 price.",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The value of the discount.",
"name": "value"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Note:\n> Whether the selection method applies to line items or shipping lines depends on the discount's\n> [target type](/docs/api/liquid/objects/discount_application#discount_application-target_type).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "all",
"description": "The discount applies to all line items or shipping lines.",
"array_value": ""
},
{
"type": "string",
"name": "entitled",
"description": "The discount applies to a specific set of line items or shipping lines based on some criteria.",
"array_value": ""
},
{
"type": "string",
"name": "explicit",
"description": "The discount applies to a specific line item or shipping line.",
"array_value": ""
}
],
"summary": "The selection method for line items or shipping lines to be discounted.",
"name": "target_selection"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "automatic",
"description": "",
"array_value": ""
},
{
"type": "string",
"name": "discount_code",
"description": "",
"array_value": ""
},
{
"type": "string",
"name": "manual",
"description": "",
"array_value": ""
},
{
"type": "string",
"name": "script",
"description": "",
"array_value": ""
}
],
"summary": "The type of the discount.",
"name": "type"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "fixed_amount",
"description": "",
"array_value": ""
},
{
"type": "string",
"name": "percentage",
"description": "",
"array_value": ""
}
],
"summary": "The value type of the discount.",
"name": "value_type"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "line_item",
"description": "",
"array_value": ""
},
{
"type": "string",
"name": "shipping_line",
"description": "",
"array_value": ""
}
],
"summary": "The type of item that the discount applies to.",
"name": "target_type"
}
],
"summary": "Information about the intent of a discount.",
"name": "discount_application",
"examples": [],
"json_data": {
"path": "/",
"handle": "cart.discount_applications[0]",
"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 行