Query cart details
The shopping cart API is used for the shopping cart interaction generated by the customer during the session, and can be called when the shopping cart details need to be obtained.
Request information
API Path:
https://{handle}.myshopline.com/api/carts/ajax-cart
Request header:
| Parameter name | Parameter type | Required or not | Array or not | Default value | describe |
|---|---|---|---|---|---|
| Content-Type | String | Y | N | application/json | |
| cookie | String | Y | N | SHOPLINE cookie |
Response information
Response body:
| Parameter name | Parameter name | Parameter name | Parameter name | Parameter name | Parameter type | Array or not | Example | describe |
|---|---|---|---|---|---|---|---|---|
| token | String | N | 36110175633573 | Shopping cart token | ||||
| note | String | N | Shopping cart notes | Shopping cart notes | ||||
| attributes | Map<String,String> | N | Shopping cart properties | |||||
| original_total_price | Double | N | Total original price of shopping cart goods | |||||
| items_subtotal_price | Double | N | Subtotal of shopping cart goods (discount of business conduct has been deducted) | |||||
| total_price | Double | N | Final pricing of shopping cart (discount of commodity and shopping cart have been deducted) | |||||
| total_discount | Double | N | Total discount amount of shopping cart (commodity line discount + shopping cart level discount) | |||||
| total_weight | Double | N | Total weight of goods | |||||
| item_count | Integer | N | Total quantity of goods in shopping cart | |||||
| requires_shipping | Boolean | N | Whether shipment is required (as long as one item in the shopping cart needs to be shipped) | |||||
| currency | String | N | settlement currency | |||||
| cart_level_discount_applications | Object | Y | Shopping cart level discount information | |||||
| amount | Double | N | Preferential amount | |||||
| discount_application | Object | N | ||||||
| type | Integer | N | ||||||
| title | String | N | Preferential name | |||||
| description | String | N | Offer describe | |||||
| value | Double | N | Preferential amount | |||||
| created_at | String | N | Activity creation time | |||||
| value_type | String | N | Discount activity type: | |||||
| target_type | String | N | ||||||
| items | Object | Y | Shopping cart item list | |||||
| id | String | N | 36110175633573 | The unique identification of the product is SKU_ id | ||||
| group_id | String | N | 0 | Item group ID | ||||
| quantity | Integer | N | 2 | Quantity of goods | ||||
| properties | Long | N | ![]() | |||||
| variant_id | String | N | 36110175633573 | Item SKU_ id | ||||
| title | String | N | test1 | Product title + SKU title name + specification | ||||
| price | Double | N | 200 | Commodity price | ||||
| original_price | Double | N | 200 | Original price of goods (may be 0) | ||||
| discounted_price | Double | N | 200 | Price after discount | ||||
| line_price | Double | N | 200 | Commodity line selling price | ||||
| original_line_price | Double | N | 200 | Original price of commodity line (may be 0) | ||||
| total_discount | Double | N | 200 | Total discount amount of a single item | ||||
| discounts | Object | Y | Discount of commodity bank | |||||
| amount | Double | N | 200 | Preferential amount | ||||
| title | String | N | 50 minus 100 | Preferential name | ||||
| sku | String | N | Red XL | Item SKU_ id | ||||
| grams | String | N | 100 | Commodity weight unit: G | ||||
| taxable | Boolean | N | true | Whether to collect tax | ||||
| product_id | String | N | 36110175633573 | Commodity SPU_ id | ||||
| gift_card | Boolean | N | true | Is it a gift card product | ||||
| final_price | Double | N | 500 | Amount of goods involved in pricing | ||||
| final_line_price | Double | N | 500 | Amount of commodity line participating in pricing | ||||
| url | String | N | https://ddfasdfasdf | Commodity master link | ||||
| featured_image | String | N | ||||||
| aspectRatio | Double | N | Aspect ratio | |||||
| alt | String | N | Mouse over prompt | |||||
| height | Integer | N | Display height | |||||
| url | String | N | picture | |||||
| width | Integer | N | Display width | |||||
| image | String | N | Product image | |||||
| handle | String | N | Product handle | |||||
| requires_shipping | String | N | Whether shipment is required | |||||
| product_title | String | N | Product title | |||||
| variant_title | String | N | Splicing of all specifications | |||||
| variant_options | String | N | Enumeration of all specifications | |||||
| options_with_values | String | N | Specifications | |||||
| name | String | N | Specifications name | |||||
| value | String | N | Specifications value | |||||
| line_level_discount_allocations | String | N | Discount of commodity bank information | |||||
| amount | Double | N | Preferential amount | |||||
| discountApplication | String | N | ||||||
| type | Integer | N | ||||||
| title | String | N | Preferential name | |||||
| description | String | N | Offer describe | |||||
| value | Double | N | Preferential amount | |||||
| created_at | String | N | Activity creation time | |||||
| value_type | String | N | Discount activity type: | |||||
| target_type | String | N | ||||||
| line_level_total_discount | Double | N | Total amount of commodity bank |
Request and response example
Scenario 1: Update the shopping cart normally
{
{
"token": "a5f1d38bf17f4578959ad0d8e4ff7cac",
"note": "Remark",
"attributes": {},
"currency": "USD",
"original_total_price": 110,
"items_subtotal_price": 101,
"total_price": 11,
"total_discount": 99,
"total_weight": 0,
"item_count": 11,
"requires_shipping": true,
"cart_level_discount_applications": [
{
"amount": 90,
"discount_application": {
"type": 1,
"title": "90 off on all items over 100",
"description": null,
"value": 90,
"created_at": null,
"value_type": "fix_amount",
"target_type": "line_item"
}
}
],
"items": [
{
"id": "18053690554475963802050412",
"properties": null,
"quantity": 10,
"title": "Custom products ",
"price": 10,
"discounts": [],
"sku": "18053690554475963802050412",
"grams": "0.0",
"taxable": true,
"url": "https://{handle}/products/Custom products",
"image": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
"group_id": "0",
"variant_id": "18053690554475963802050412",
"original_price": 0,
"discounted_price": 10,
"line_price": 100,
"original_line_price": 0,
"total_discount": 0,
"product_id": "16053690554473111675530412",
"gift_card": false,
"final_price": 10,
"final_line_price": 100,
"featured_image": {
"alt": null,
"height": null,
"url": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
"width": null,
"aspect_ratio": null
},
"requires_shipping": true,
"product_title": "Custom products",
"variant_title": "",
"variant_options": [],
"options_with_values": [],
"line_level_discount_allocations": [],
"line_level_total_discount": 0
},
{
"id": "18053340946130027787140412",
"properties": null,
"quantity": 1,
"title": "Only limited time promotion items ",
"price": 10,
"discounts": [
{
"amount": 9,
"title": "Promotion"
}
],
"sku": "18053340946130027787140412",
"grams": "0.0",
"taxable": true,
"url": "https://{handle}//products/Onlylimitedtimepromotionitems",
"image": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
"handle": "Only limited time promotion items",
"group_id": "0",
"variant_id": "18053340946130027787140412",
"original_price": 0,
"discounted_price": 1,
"line_price": 10,
"original_line_price": 0,
"total_discount": 9,
"product_id": "16053340946118954823760412",
"gift_card": false,
"final_price": 1,
"final_line_price": 1,
"featured_image": {
"alt": null,
"height": null,
"url": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
"width": null,
"aspect_ratio": null
},
"requires_shipping": true,
"product_title": "Only limited time promotion items",
"variant_title": "",
"variant_options": [],
"options_with_values": [],
"line_level_discount_allocations": [
{
"amount": 9,
"discount_application": {
"type": 8,
"title": "Promotion",
"description": null,
"value": 9,
"created_at": null,
"value_type": null,
"target_type": "line_item"
}
}
],
"line_level_total_discount": 9
}
]
}
Scenario 2: Request Error:
POST https://{handle}.myshopline.com/api/carts/ajax-cart/update.js
status:404
{
"message": "error code",
"description": "error description"
}
Was this article helpful to you?
