cart.removeFromCart

This method is used to remove items from a Cart.

Version

v2

Arguments

This method has the path /cart/<version>/cart.removeFromCart and follows the MicroBase API calling conventions.

Argument Required Type Example Description
cartId yes String H19PRsec The id of the Cart.
itemId yes String HyR1hMmc The id of the item to remove.
quantity yes Number 1 The quantity of product to remove from the Cart.

Response

Returns the complete cart:

{
  "ok": true,
  "cart": {
    "id": "H19PRsec",
    "status": "ACTIVE",
    "customerId": "ANON",
    "currency": "USD",
    "channel": "WEB",
    "expirationTime": "2018-05-31T15:12:54.096Z",
    "items": [
      {
        "id": "HJsKZud1X",
        "productId": "rylW3KZvJX",
        "title": "0001 - Gel Noosa Tri 11 (ASics)",
        "quantity": 3,
        "price": {
          "amount": 11900,
          "currency": "USD",
          "precision": 2
        },
        "taxes": [
          {
            "beforeTax": {
              "amount": 35700,
              "currency": "USD",
              "precision": 2
            },
            "tax": {
              "amount": 7497,
              "currency": "USD",
              "precision": 2
            },
            "taxDetail": "IVA 21%"
          }
        ],
        "discounts": [],
        "reserves": []
      }
    ],
    "promotions": {
      "almostFulfilledPromos": [],
      "fulfilledPromos": [],
      "ok": true
    },
    "taxes": {
      "ok": true,
      "beforeTax": {
        "amount": 35700,
        "currency": "USD",
        "precision": 2
      },
      "tax": {
        "amount": 7497,
        "currency": "USD",
        "precision": 2
      }
    }
  }
}

Errors

Expected errors that this method could return. Some errors return additional data.

Error Data Description
cart_not_found - The Cart was not found
item_not_found - The item was not found

Example

curl --request POST \
  --url http://localhost:3000/services/cart/v1/cart.addToCart?cartId=H19PRsec \
  --header 'authorization: Bearer xxxxx...' \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{ "cartId": "H19PRsec", "itemId": "HyR1hMmc", "quantity", 1 }'