Getting Collection Names Of Products in Shopify

空扰寡人 提交于 2021-01-27 12:01:20

问题


In Shopify how do I fetch names of custom collection that a particular product belongs to ?

Like for example to get SKU I can use {{ line_item.sku }} or to get Price I can use {{ line_item.line_price }}


回答1:


From the API docs, to list all custom collections for a certain product_id:

GET /admin/custom_collections.json?product_id=632910392

Response:

HTTP/1.1 200 OK

{
  "custom_collections": [
    {
      "body_html": "<p>The best selling ipod ever</p>",
      "handle": "ipods",
      "id": 841564295,
      "published_at": "2008-02-01T19:00:00-05:00",
      "sort_order": "manual",
      "template_suffix": null,
      "title": "IPods",
      "updated_at": "2008-02-01T19:00:00-05:00",
      "image": {
        "created_at": "2012-12-11T12:01:29-05:00",
        "src": "http://cdn.shopify.com/s/files/1/0006/9093/3842/collections/ipod_nano_8gb.jpg?0"
      }
    }
  ]
}


来源:https://stackoverflow.com/questions/14230720/getting-collection-names-of-products-in-shopify

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!