Boz*_*Boz 4 php paypal shopify
我正在考虑使用Shopify管理我的商店.我需要使用API将产品添加到网站.
我可以通过此API调用获取产品和库存:
http://api.shopify.com/product.html#index
但是,那么我想'添加到购物篮' - 我无法从API文档中看到如何做到这一点.一旦添加到篮子里 - 我想获得篮子内容所以我可以显示像...
"2 items : £130 - checkout"
Run Code Online (Sandbox Code Playgroud)
我不需要详细的答案 - 只需指出正确的方向 - 谢谢.
Shopify后端对个人用户推车一无所知,它们只存在于浏览器领域.我的错误,后端知道购物车,但你不能通过REST API编辑它们.如果您有兴趣购买推车,这是推车终点.
要操纵用户的购物车,您需要使用店面中的Ajax API.具体来说,此调用会将产品添加到购物车:
http://store.myshopify.com/cart.add.js?quantity=2&id=30104012
Run Code Online (Sandbox Code Playgroud)
返回看起来像这样的json:
{
"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
}
Run Code Online (Sandbox Code Playgroud)
您可以使用以下调用获取购物车:
http://store.myshopify.com/cart.js
Run Code Online (Sandbox Code Playgroud)
哪个会给你这个:
{
"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
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3241 次 |
| 最近记录: |