🧑‍💻

【Shopify.dev和訳】Ajax API/Reference/Product

2021/09/12に公開

この記事について

この記事は、Product API referenceの記事を和訳したものです。

記事内で使用する画像は、公式ドキュメント内の画像を引用して使用させていただいております。

Shopify アプリのご紹介

Shopify アプリである、「商品ページ発売予告アプリ | リテリア Coming Soon」は、商品ページを買えない状態のまま、発売日時の予告をすることができるアプリです。Shopify で Coming Soon 機能を実現することができます。

https://apps.shopify.com/shopify-application-314?locale=ja&from=daniel

Shopify アプリである、「らくらく日本語フォント設定|リテリア Font Picker」は、ノーコードで日本語フォントを使用できるアプリです。日本語フォントを導入することでブランドを演出することができます。

https://apps.shopify.com/font-picker-1?locale=ja&from=daniel

Product API reference

Ajax Product API を使用して、任意の製品の情報に対して GET リクエストを行うことができます。

GET /products/{product-handle}.js

商品ハンドルを使用して、商品の JSON を取得します。

すべての金額プロパティは、顧客の予約通貨で返されます。顧客の請求通貨を確認するには、/cart.js エンドポイントの currency フィールドを使用します。複数の通貨での販売についての詳細は、「複数の通貨をサポートするための移行」を参照してください。

jQuery を使用したコーディング例:

jQuery.getJSON("/products/red-rain-coat.js", function (product) {
  alert("The title of this product is " + product.title)
})

Response

商品の JSON。

Example:

Response
{
  "id": 329678821,
  "title": "Red Rain Coat",
  "handle": "red-rain-coat",
  "description": "<p>Lorem Ipsum.</p>",
  "published_at": "2014-06-12T16:28:11-04:00",
  "created_at": "2014-06-12T16:28:13-04:00",
  "vendor": "Shopify",
  "type": "Coat",
  "tags": [
    "Spring"
  ],
  "price": 12900,
  "price_min": 12900,
  "price_max": 12900,
  "available": true,
  "price_varies": false,
  "compare_at_price": null,
  "compare_at_price_min": 0,
  "compare_at_price_max": 0,
  "compare_at_price_varies": false,
  "variants": [
    {
      "id": 794864229,
      "title": "Small",
      "options": [
        "Small"
      ],
      "option1": "Small",
      "option2": null,
      "option3": null,
      "price": 12900,
      "weight": 0,
      "compare_at_price": null,
      "inventory_management": "shopify",
      "available": true,
      "sku": null,
      "requires_shipping": true,
      "taxable": true,
      "barcode": "49738645"
    },
    {
      "id": 794864233,
      "title": "Medium",
      "options": [
        "Medium"
      ],
      "option1": "Medium",
      "option2": null,
      "option3": null,
      "price": 12900,
      "weight": 0,
      "compare_at_price": null,
      "inventory_management": "shopify",
      "available": true,
      "sku": null,
      "requires_shipping": true,
      "taxable": true,
      "barcode": "49738657"
    },
    {
      "id": 794864237,
      "title": "Large",
      "options": [
        "Large"
      ],
      "option1": "Large",
      "option2": null,
      "option3": null,
      "price": 12900,
      "weight": 0,
      "compare_at_price": null,
      "inventory_management": "shopify",
      "available": true,
      "sku": null,
      "requires_shipping": true,
      "taxable": true,
      "barcode": "49738673"
    }
  ],
  "images": [
    "//cdn.shopify.com/s/files/1/0040/7092/products/red-rain-coat.jpeg?v=1402604893"
  ],
  "featured_image": "//cdn.shopify.com/s/files/1/0040/7092/products/red-rain-coat.jpeg?v=1402604893",
  "options": [
    {
      "name": "Size",
      "position": 1
    }
  ],
  "url": "/products/red-rain-coat"
}

販売プランの例

販売計画のある商品は、/products/<handle>.js で以下の追加プロパティが利用できます。

{
 "id":5290511958181,
 // ...
 "variants":[
    {
       "id":34620489400485,
       // ...
       "requires_selling_plan":false,
       "selling_plan_allocations":[
          {
             "price":3120,
             "compare_at_price":3900,
             "per_delivery_price":3120,
             "selling_plan_id":360613,
             "selling_plan_group_id":14699254537353206000
          },
          {
             "price":3510,
             "compare_at_price":3900,
             "per_delivery_price":3510,
             "selling_plan_id":393381,
             "selling_plan_group_id":14699254537353206000
          }
       ]
    }
 ],
 "requires_selling_plan":false,
 "selling_plan_groups":[
    {
       "id":14699254537353206000,
       "name":"Subscribe and Save",
       "options":[
          {
             "name":"Delivery Frequency",
             "position":1,
             "values":[
                "Month",
                "Week"
             ]
          },
          {
             "name":"Billing Frequency",
             "position":2,
             "values":[
                "Month",
                "Week"
             ]
          }
       ],
       "selling_plans":[
          {
             "id":360613,
             "name":"Pay every month, delivery every month | save 20%",
             "description":"No commitment · Auto-renews · Skip or cancel anytime",
             "options":[
                {
                   "name":"Delivery Frequency",
                   "position":1,
                   "value":"Month"
                },
                {
                   "name":"Billing Frequency",
                   "position":2,
                   "value":"Month"
                }
             ],
             "recurring_deliveries":true
          },
          {

Shopify アプリのご紹介

Shopify アプリである、「商品ページ発売予告アプリ | リテリア Coming Soon」は、商品ページを買えない状態のまま、発売日時の予告をすることができるアプリです。Shopify で Coming Soon 機能を実現することができます。

https://apps.shopify.com/shopify-application-314?locale=ja&from=daniel

Shopify アプリである、「らくらく日本語フォント設定|リテリア Font Picker」は、ノーコードで日本語フォントを使用できるアプリです。日本語フォントを導入することでブランドを演出することができます。

https://apps.shopify.com/font-picker-1?locale=ja&from=daniel

Discussion

ログインするとコメントできます