Update Shopping Cart Interface

Update the quantity or other information of a specified product in the shopping cart, supporting modification of product quantity, SKU, and order extension information.

Precautions

  • This interface uses the POST method and requires data to be submitted in application/ format
  • Need to provide the product ID and the new quantity
  • Supports logged-in users and non-logged-in users (identified by cart token)
  • If the product is not in the shopping cart, a new record will be added
  • You can specify the specific product specifications by SKU ID

Request address

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

Description:{域名地址}Need to replace it with your domain address, such ashttps://en.anqicms.com/api/cart/update

Request syntax

POST {域名地址}/api/cart/update
Content-Type: application/json

Request header

Field Name Type Required Description
cart string No When not logged in, use this token as user identification

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

Request Parameters

| Field Name | Type | Required| Description |

archive_id integer Yes
sku_id integer No
quantity integer Yes
order_extra object

Response Headers

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

Return parameters

Field Name Type Description
code integer Error code
message string Error Description

Example Usage

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 Unauthorized
200 API request OK