Cart
Update Product In Cart

Update Product In Cart

Update product item in user cart by product id

Endpoint

Base URL
http://localhost:8080
Method and Endpoint
PATCH /api/users/current/cart-item
Headers
Authorization: Bearer access_token

Query Param

product_id : string (required)

Request Body

Request Body
{
    "quantity": "2",
    "selected": false
}

Responses

You will get example responses like this:

200 (success)

Response Body
{
  "message": "Successfully update product in the cart",
}

400 (bad request)

Response Body
{
    "error": "quantity cannot be less than 0"
}

500 (server error)

Response Body
{
  "error": "Internal server error"
}

500 (server error - failed)

If query to database get troble while get the user cart data

Response Body
{
  "error": "failed check user cart"
}

500 (server error - failed)

If something went wrong while update product in user cart data

Response Body
{
  "error": "failed to update product in the cart"
}