📘 公式リファレンス📦 リファレンス/オブジェクト中級
quantity_rule オブジェクト
バリアント単位で設定された注文数量ルール(最小・最大・増分)を参照するオブジェクト。B2B カタログで数量制限を施す際に利用する。
用途
B2B 向けストアで、商品バリアントごとに注文数量の制約(例: 最小5個単位、最大100個まで)を適用し、その制限をカート・チェックアウトに反映させるとき。
設置場所
Liquid 内で `{{ product.variants.first.quantity_rule.min }}`、`{{ product.variants.first.quantity_rule.max }}`、`{{ product.variants.first.quantity_rule.increment }}` の形で参照する。
注意点
B2B カタログで明示的に数量ルールを設定しない場合、デフォルト値(min=1、max=nil、increment=1)が返される。max が上限なしの場合は `nil` となるため、Liquid の `if quantity_rule.max` で存在チェックしておく。
仕様
85 行 / json{
"access": {
"global": false,
"parents": [
{
"object": "variant",
"property": "quantity_rule"
}
],
"template": []
},
"deprecated": false,
"deprecation_reason": "",
"description": "If no rule exists, then a default value is returned.\n\nThis rule can be set as part of a [B2B catalog](https://help.shopify.com/manual/b2b/catalogs/quantity-pricing).\n\n> Note:\n> The default quantity rule is `min=1,max=null,increment=1`.",
"properties": [
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The minimum order quantity. The default value is `1`.",
"name": "min"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "If there is no maximum quantity, then `nil` is returned.",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The maximum order quantity.",
"name": "max"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The number the order quantity can be incremented by. The default value is `1`.",
"name": "increment"
}
],
"summary": "A variant order quantity rule.",
"name": "quantity_rule",
"examples": [
{
"name": "The variant order quantity rule",
"description": "",
"syntax": "",
"path": "/products/health-potion",
"raw_liquid": "{{ product.variants.first.quantity_rule }}",
"parameter": false,
"display_type": "text",
"show_data_tab": true
}
],
"json_data": {
"path": "",
"handle": "",
"data_from_file": "{\"min\":5,\"max\":100,\"increment\":5}"
},
"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 行