Update shopping cart interface
Update the quantity or other information of the specified product in the shopping cart, supporting modification of product quantity, SKU, and order extension information.
Points to note
- The API uses the POST method and requires data to be submitted in application/ format
- Provide the product ID and the new quantity
- Supports logged-in users and anonymous users (identified through cart token)
- If the product does not exist in the shopping cart, a new record will be added
- Specify the specific product specification by SKU ID
Request address
{域名地址}/api/cart/update
Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/cart/update
Request Syntax
POST {域名地址}/api/cart/update
Content-Type: application/json
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 |
| archive_id | int | Is |
| sku_id | int | No |
| quantity | int | Is |
| order_extra | object |
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 |
Usage Example
Request example
POST /api/cart/update HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json
{
"archive_id": 1,
"sku_id": 1,
"quantity": 3,
"order_extra": {
"gift_wrapping": true,
"message": "生日快乐"
}
}
Response Example
{
"code": 0,
"msg": "保存成功"
}
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 |