Get shopping cart list interface

Get the list of products in the current user's shopping cart, support pagination, and return product details and related shopping cart data.

Points to note

  • The interface supports logged-in users and non-logged-in users (identified through cart token)
  • Support pagination, can be controlled by the current and pageSize parameters
  • The returned product information includes the quantity, price, and other information in the shopping cart
  • Total field returns the total number of items in the shopping cart

Request address

{域名地址}/api/cart/list

Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/cart/list

Request Syntax

GET {域名地址}/api/cart/list?{参数}

Request Headers

Field name Type Required Description
cart string No Use this token as user identification when not logged in

This interface also involves common request headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Request parameters

Field name Type Required Description
current int No Retrieve specified pagination data, current page number
pageSize int No Display quantity, number per page

Response header

This interface only involves common response headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Return parameters

Field name Type Description
code int Error code
msg string Error description
data object[] Content, shopping cart product list
Total int Total number of products in shopping cart

data result item parameter

Field name Type Description
id int Shopping cart ID
archive_id int Product ID
sku_id int SKU ID, 0 indicates no specification
sku_values array List of SKU options
quantity int Quantity purchased
origin_price int Price at the time of adding to cart, in cents
status int Status
user_id int user ID
token string Cart token for identifying unlogged users
created_time int Timestamp when added to cart
updated_time int update timestamp
order_extra object Order extension information
price int The current calculated price, in cents (considering factors such as SKU, markup attributes, wholesale price, etc.)
amount int Subtotal amount, in cents (quantity × price)
original amount int Original amount, in cents (quantity × origin_price)
archive object Product Details
sku object SKU information (returned only when specifications are present)
archive product object
Field name Type Description
id int Product ID
Title string product title
seo title string SEO title
URL Token string URL alias
keywords string Keywords
description string Introduction
module_id int Model ID
category_id int Category ID
Views int view count
Comment Count int number of comments
Images array product gallery
Logo string Product Logo
thumbnail string Product Thumbnail
flag string Recommended Attributes: Headline [h] Recommended [c] Slide [f] Special Recommendation [a] Scrolling [s] Bold [b] Image [p] Jump [j]
canonical_url string Standard link
fixed link string Fixed link
created_time int publish timestamp
updated_time int update timestamp
status int Status
user_id int user ID
price int Product price, in cents
stock int inventory quantity
wholesale rule object Wholesale rules applicable (return when the product is a wholesale type and reaches the minimum order quantity)
sku_values option value object
Field name Type Description
id int Option value ID
option id int Specification ID
Title string Option value name (e.g. 'Red')
option title string Specification name (e.g. 'Color')
price int Additional amount, in cents
stock int inventory quantity
sku SKU object
Field name Type Description
id int SKU ID
Title string SKU Name (e.g. Red-L)
price int SKU Price, in Cents
stock int SKU Stock Quantity
thumbnail string SKU Thumbnail
sku string Product Number
barcode string Barcode
wholesale_rule wholesale rule object
Field name Type Description
id int Rule ID
min_quantity int minimum order quantity
max_quantity int maximum quantity limit
discount_rate int discount rate (percentage)

Usage Example

Request example

GET /api/cart/list?current=1&pageSize=20 HTTP/1.1
Host: your-domain.com
Content-Type: application/json

Response Example

{
  "code": 0,
  "data": [
    {
      "id": 123,
      "archive_id": 456,
      "sku_id": 789,
      "sku_values": [
        {
          "id": 1,
          "option_id": 10,
          "title": "红色",
          "option_title": "颜色",
          "price": 0,
          "stock": 100
        },
        {
          "id": 5,
          "option_id": 11,
          "title": "L",
          "option_title": "尺码",
          "price": 0,
          "stock": 50
        }
      ],
      "user_id": 1,
      "token": "abc123-def456",
      "quantity": 2,
      "origin_price": 2999,
      "status": 0,
      "created_time": 1607308159,
      "updated_time": 1662717106,
      "order_extra": {},
      "price": 2999,
      "amount": 5998,
      "origin_amount": 5998,
      "archive": {
        "id": 456,
        "title": "AnqiCMS 限量版 T 恤",
        "seo_title": "",
        "url_token": "anqicms-tshirt",
        "keywords": "T桖,周边,限量",
        "description": "AnqiCMS 官方限量版 T 恤,纯棉材质,舒适透气",
        "module_id": 1,
        "category_id": 5,
        "views": 1338,
        "comment_count": 10,
        "images": [],
        "status": 1,
        "user_id": 0,
        "price": 2999,
        "stock": 100,
        "wholesale_rule": {
          "id": 1,
          "min_quantity": 10,
          "max_quantity": 0,
          "discount_rate": 90
        }
      },
      "sku": {
        "id": 789,
        "title": "红色-L",
        "price": 3299,
        "stock": 50,
        "thumb": "https://www.example.com/uploads/thumb_sku.webp",
        "sku": "TSHIRT-RED-L",
        "barcode": "1234567890123"
      }
    }
  ],
  "msg": "",
  "total": 1
}

error code

Error code Description
0 OK
-1 Error, the reason is indicated in msg
1001 Not logged in
1002 Not authorized
200 API request OK