Php Shopify API-添加到购物篮
我正在考虑使用Shopify来管理我的店铺。我需要添加的产品与API的网站 我可以通过此API调用获取产品和库存: 但是,接下来我想“添加到篮子中”——我无法从API文档中看到如何做到这一点。 一旦添加到篮子-我想得到篮子的内容,这样我可以显示像Php Shopify API-添加到购物篮,php,paypal,shopify,Php,Paypal,Shopify,我正在考虑使用Shopify来管理我的店铺。我需要添加的产品与API的网站 我可以通过此API调用获取产品和库存: 但是,接下来我想“添加到篮子中”——我无法从API文档中看到如何做到这一点。 一旦添加到篮子-我想得到篮子的内容,这样我可以显示像 "2 items : £130 - checkout" 我不需要详细的答案-只要给我指出正确的方向-谢谢。Shopify后端对个人用户购物车一无所知,它们只存在于浏览器领域。我的错误是,后端确实知道Cart,但是您不能通过RESTAPI编辑它们
"2 items : £130 - checkout"
我不需要详细的答案-只要给我指出正确的方向-谢谢。Shopify后端对个人用户购物车一无所知,它们只存在于浏览器领域。我的错误是,后端确实知道Cart,但是您不能通过RESTAPI编辑它们
要操作用户的购物车,您需要从店面使用。具体而言,将向购物车添加产品:
http://store.myshopify.com/cart.add.js?quantity=2&id=30104012
返回类似以下内容的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
}
您可以使用以下工具获取购物车本身:
这将为您带来:
{
"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
}
您好,先生,是否可以通过API向购物车添加自定义内容?比如说,如果我想在没有id的情况下将自定义名称、自定义描述和自定义价格放入购物车?非常感谢,先生。
{
"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
}