product オブジェクト
商品の詳細情報(タイトル、価格、バリアント、メタフィールドなど)にアクセスするオブジェクト。商品ページやコレクション、検索結果、関連商品などで商品データを参照するときに用いる。
仕様
782 行 / json{
"access": {
"global": false,
"parents": [
{
"object": "all_products",
"property": ""
},
{
"object": "collection",
"property": "products"
},
{
"object": "line_item",
"property": "product"
},
{
"object": "link",
"property": "object"
},
{
"object": "metafield",
"property": "value"
},
{
"object": "recommendations",
"property": "products"
},
{
"object": "search",
"property": "results"
},
{
"object": "variant",
"property": "product"
}
],
"template": [
"product"
]
},
"deprecated": false,
"deprecation_reason": "",
"description": "",
"properties": [
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "selling_plan_group"
}
],
"summary": "The selling plan groups that the variants of the product are included in.",
"name": "selling_plan_groups"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Tip:\n> To learn about how to create metafields, refer to [Create and manage metafields](/apps/metafields/manage) or visit\n> the [Shopify Help Center](https://help.shopify.com/manual/metafields).",
"examples": [],
"return_type": [
{
"type": "untyped",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The [metafields](/docs/api/liquid/objects/metafield) applied to the product.",
"name": "metafields"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "product_option"
}
],
"summary": "The options on the product.",
"name": "options_with_values"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "taxonomy_category",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The taxonomy category for the product",
"name": "category"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Note:\n> Returns a maximum of 250 variants when unpaginated.\n> Tip:\n> Use the [paginate](/docs/api/liquid/tags/paginate) tag to choose how many variants to show per page, up to a limit of 50.",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "variant"
}
],
"summary": "The variants of the product.",
"name": "variants"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The total number of variants for the product.",
"name": "variants_count"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The ID of the product.",
"name": "id"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The title of the product.",
"name": "title"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The [handle](/docs/api/liquid/basics#handles) of the product.",
"name": "handle"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "The name doesn't include the `product.` prefix, or the file extension (`.json` or `.liquid`).\n\nIf a custom template isn't assigned to the product, 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) of the product.",
"name": "template_suffix"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The vendor of the product.",
"name": "vendor"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Note:\n> This is the same value as [`product.content`](/docs/api/liquid/objects/product#product-content).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The description of the product.",
"name": "description"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Note:\n> This is the same value as [`product.description`](/docs/api/liquid/objects/product#product-description).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The description of the product.",
"name": "content"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "image",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The first (featured) image attached to the product.",
"name": "featured_image"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Note:\n> In search results or a filtered collection, the [media](/docs/api/liquid/objects/media) of the most relevant variant is returned. Relevancy is based on search terms and applied filters.\n\n> Tip:\n> You can use [media filters](/docs/api/liquid/filters/media-filters) to output media URLs and displays. To learn about how\n> to include media in your theme, refer to [Support product media](/themes/product-merchandising/media/support-media).",
"examples": [],
"return_type": [
{
"type": "media",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The first (featured) media attached to the product.",
"name": "featured_media"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Tip:\n> You can use [media filters](/docs/api/liquid/filters/media-filters) to output media URLs and displays. To learn about how\n> to include media in your theme, refer to [Support product media](/themes/product-merchandising/media/support-media).",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "media"
}
],
"summary": "The media attached to the product, sorted by the date it was added to the product.",
"name": "media"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "image"
}
],
"summary": "The images attached to the product.",
"name": "images"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Note:\n> This is the same value as [`product.price`](/docs/api/liquid/objects/product#product-price).\n\nThe 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 price.",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The lowest price of any variants of the product in the currency's subunit.",
"name": "price_min"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Note:\n> This is the same value as [`product.price_min`](/docs/api/liquid/objects/product#product-price_min).\n\nThe 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 price.",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The lowest price of any variants of the product in the currency's subunit.",
"name": "price"
},
{
"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 price.",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The highest price of any variants of the product in the currency's subunit.",
"name": "price_max"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "boolean",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Returns `true` if the product's variant prices vary. Returns `false` if not.",
"name": "price_varies"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "If a variant is selected, it will be returned, regardless of its availability. Otherwise, the first available variant is returned. If no available variant exists, the first variant is returned.\n\nA selected variant is determined by the following criteria:\n\n- On product pages, it is based on the variant ID set in the `variant` URL parameter.\n- In search results and filtered collections, it is the most relevant variant based on search terms and applied filters.\n\nFor a variant to be available, it needs to meet one of the following criteria:\n\n- The `variant.inventory_quantity` is greater than 0.\n- The `variant.inventory_policy` is set to `continue`.\n- The `variant.inventory_management` is `nil`.",
"examples": [],
"return_type": [
{
"type": "variant",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The currently selected or first available variant of the product.",
"name": "selected_or_first_available_variant"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Note:\n> Collections that aren't [available](https://help.shopify.com/manual/products/collections/make-collections-available) on\n> the Online Store sales channel aren't included.",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "collection"
}
],
"summary": "The collections that the product belongs to.",
"name": "collections"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "If no variant is currently selected, then `nil` is returned.\n\n> Note:\n> On product pages, it is based on the variant ID set in the `variant` URL parameter.\n> In search results and filtered collections, it is the most relevant variant based on search terms and applied filters.",
"examples": [],
"return_type": [
{
"type": "variant",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The currently selected variant of the product.",
"name": "selected_variant"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "For a variant to be available, it needs to meet one of the following criteria:\n\n- The `variant.inventory_quantity` is greater than 0.\n- The `variant.inventory_policy` is set to `continue`.\n- The `variant.inventory_management` is `nil`.",
"examples": [],
"return_type": [
{
"type": "variant",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The first available variant of the product.",
"name": "first_available_variant"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "For a variant to be available, it needs to meet one of the following criteria:\n\n- The `variant.inventory_quantity` is greater than 0.\n- The `variant.inventory_policy` is set to `continue`.\n- The `variant.inventory_management` is `nil`.\n- The variant has an associated [delivery profile](/docs/apps/selling-strategies/purchase-options/deferred/shipping-delivery/delivery-profiles) with a valid shipping rate.",
"examples": [],
"return_type": [
{
"type": "boolean",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Returns `true` if at least one of the variants of the product is available. Returns `false` if not.",
"name": "available"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [
{
"name": "Output the options",
"description": "You can use the [`size` filter](/docs/api/liquid/filters/size) with dot notation to determine how many options a product has.\n",
"syntax": "",
"path": "/products/health-potion",
"raw_liquid": "{% if product.options.size > 0 -%}\n {% for option in product.options -%}\n - {{ option }}\n {%- endfor %}\n{%- endif %}",
"parameter": false,
"display_type": "text",
"show_data_tab": true
}
],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "string"
}
],
"summary": "The option names of the product.",
"name": "options"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The type of the product.",
"name": "type"
},
{
"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 price.",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The lowest **compare at** price of any variants of the product in the currency's subunit. This is the same as\n`product.compare_at_price`.",
"name": "compare_at_price_min"
},
{
"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 price.",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The highest **compare at** price of any variants of the product in the currency's subunit.",
"name": "compare_at_price_max"
},
{
"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 price.",
"examples": [],
"return_type": [
{
"type": "number",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The lowest **compare at** price of any variants of the product in the currency's subunit.",
"name": "compare_at_price"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "boolean",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Returns `true` if the variant **compare at** prices of the product vary. Returns `false` if not.",
"name": "compare_at_price_varies"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "If a product is rendered in search results or a filtered collection, then the URL contains the `variant` parameter of the most relevant variant.\n\n```liquid\n/products/gorgeous-wooden-computer?variant=1234567890\n```\n\nIf a product is rendered as a [product recommendation](/docs/themes/product-merchandising/recommendations), then the URL contains tracking parameters:\n\n```liquid\n/products/gorgeous-wooden-computer?pr_choice=default&pr_prod_strat=description&pr_rec_pid=13&pr_ref_pid=17&pr_seq=alternating\n```",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The relative URL of the product.",
"name": "url"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Note:\n> The tags are returned in alphabetical order.",
"examples": [],
"return_type": [
{
"type": "array",
"name": "",
"description": "",
"array_value": "string"
}
],
"summary": "The [tags](https://help.shopify.com/manual/shopify-admin/productivity-tools/using-tags) of the product.",
"name": "tags"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> 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 product was published.",
"name": "published_at"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> 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 product was created.",
"name": "created_at"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [
{
"name": "Output the values for a specific option",
"description": "When accessing a specific option, the name is case-insensitive.",
"syntax": "",
"path": "/products/health-potion",
"raw_liquid": "<label>\n Strength\n <select>\n {%- for value in product.options_by_name['strength'].values %}\n <option>{{ value }}</option>\n {%- endfor %}\n </select>\n</label>",
"parameter": false,
"display_type": "text",
"show_data_tab": false
}
],
"return_type": [
{
"type": "untyped",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Allows you to access a specific [product option](/docs/api/liquid/objects/product_option) by its name.",
"name": "options_by_name"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "boolean",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Returns `true` if the product doesn't have any options. Returns `false` if not.",
"name": "has_only_default_variant"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "boolean",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Returns `true` if the product has at least one variant with quantity price breaks in the current customer context.\nReturns `false` if not.",
"name": "quantity_price_breaks_configured?"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Note:\n> A variant requires a selling plan if [`variant.requires_selling_plan`](/docs/api/liquid/objects/variant#variant-requires_selling_plan)\n> is `true`.",
"examples": [],
"return_type": [
{
"type": "boolean",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Returns `true` if all of the variants of the product require a selling plan. Returns `false` if not.",
"name": "requires_selling_plan"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "If no selling plan is selected, then `nil` is returned.\n\n> Note:\n> The selected selling plan is determined by the `selling_plan` URL parameter.",
"examples": [],
"return_type": [
{
"type": "selling_plan",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The currently selected selling plan.",
"name": "selected_selling_plan"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "If no variant and selling plan are selected, then `nil` is returned.\n\n> Note:\n> The selected variant is determined by the `variant` URL parameter, and the selected selling plan is determined by the\n> `selling_plan` URL parameter.",
"examples": [],
"return_type": [
{
"type": "selling_plan_allocation",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The currently selected selling plan allocation for the currently selected variant.",
"name": "selected_selling_plan_allocation"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "The following logic is used to determine which selling plan allocation is returned:\n\n| Selling plan allocation | Return criteria |\n| --- | --- |\n| The currently selected allocation | Returned if a variant and selling plan are selected.<br><br>The selected variant is determined by the `variant` URL parameter, and the selected selling plan is determined by the `selling_plan` URL parameter. |\n| The first allocation on the first available variant | Returned if no allocation is currently selected. |\n| The first allocation on the first variant | Returned if no allocation is currently selected, and there are no available variants. |\n\nIf the product doesn't have any selling plans, then `nil` is returned.",
"examples": [],
"return_type": [
{
"type": "selling_plan_allocation",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The currently selected, or first available, selling plan allocation.",
"name": "selected_or_first_available_selling_plan_allocation"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "boolean",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Returns `true` if the product is a gift card. Returns `false` if not.",
"name": "gift_card?"
}
],
"summary": "A [product](https://help.shopify.com/manual/products) in the store.",
"name": "product",
"examples": [],
"json_data": {
"path": "/products/health-potion",
"handle": "product",
"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> タグ内に埋め込む必須要素。
metaobjects オブジェクト
ストア全体のメタオブジェクト定義にアクセスするグローバルオブジェクト。個別のメタオブジェクトはタイプとハンドルで参照でき、メタオブジェクト定義のエントリをループで反復処理できる。
additional_checkout_buttons オブジェクト
PayPal Express Checkout など、オフサイト決済に対応した外部決済プロバイダーがストアに設定されているかを真偽値で返す。`content_for_additional_checkout_buttons` と組み合わせて、該当するチェックアウトボタンを条件付きで表示する。
canonical_url オブジェクト
現在のページの正規 URL を取得するオブジェクト。Google などの検索エンジンに対してどのページ版が正規であるかを指定するために使用する。
content_for_index オブジェクト
ホームページに表示するセクションの内容を動的に返すオブジェクト。Liquid インデックステンプレートで必ず使用する。
content_for_additional_checkout_buttons オブジェクト
PayPal、Apple Pay、Google Pay など複数の決済プロバイダが有効になっているとき、その決済ボタンを HTML として出力するオブジェクト。`additional_checkout_buttons` で有無を判定したうえで、このオブジェクトで実際のボタンを表示する。