这两个页面应该帮助你:
Adding to the Cart from a remote website
我不知道自己在做什么添加到购物车,现在,但是这是“正确”的方式做到这一点。看到你已经有了这个工作,我不会太担心。
为了让车,你应该使用AJAX API。该API允许您为当前用户提供购物车,而无需使用您链接的REST版本。那个设计用于做更重的举重(例如获得当前所有的活动推车)。 AJAX版本非常简单,专为前端使用而设计。简单而言,只需拨打
http://[the-shop].myshopify.com/cart.js
,你会回来的车的内容为JSON当前会话。它会是这个样子:
{
"items": [
{
"handle": "aquarius",
"line_price": 6000,
"requires_shipping": true,
"price": 2000,
"title": "aquarius - medium",
"url": "/products/aquarius",
"quantity": 3,
"id": 30104042,
"grams": 181,
"sku": "",
"vendor": "the candi factory",
"image": "http://static.shopify.com/s/files/1/0040/7092/products/aquarius_1.gif?1268045506",
"variant_id": 30104042
},
{
"handle": "amelia",
"line_price": 4000,
"requires_shipping": true,
"price": 2000,
"title": "amelia - medium",
"url": "/products/amelia",
"quantity": 2,
"id": 30104012,
"grams": 200,
"sku": "",
"vendor": "the candi factory",
"image": "http://static.shopify.com/s/files/1/0040/7092/products/2766315_da1b.png?1268045506",
"variant_id": 30104012
}
],
"requires_shipping": true,
"total_price": 10000,
"attributes": null,
"item_count": 5,
"note": null,
"total_weight": 947
}
感谢您的回复。过去一周我们一直在研究这个问题,我们遇到的问题是将shopify的信息拖到我们自己的网站上,这似乎并不奏效。 Shopify中是否有安全功能可防止将该信息(购物车中的物品)拉到远程站点? – flinx777 2012-05-07 19:00:39
没有。您可能遇到[相同来源策略](http://en.wikipedia.org/wiki/Same_origin_policy)问题,但数据应该可用。 – 2012-05-08 03:28:11