> ## Documentation Index
> Fetch the complete documentation index at: https://docs.salesive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Remove cart item

> Remove a product or variant from the cart.

## Remove base product line item

Use this route when the line item refers to the base product (no variant).

```http theme={null}
DELETE /cart/692cd420b07303c9be5eafd7
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
```

The path id may be the cart line's own `_id`, or the product, food, or service id it holds. Removing by a **catalog id** (product/food/service) drops **every** line for that item — so removing a food that was added with two different add-on combinations clears both lines in one call. To remove a single line, pass that line's `_id`.

## Remove by item ID

You can also remove any cart item (including food and service items) directly by its `_id`. Use this to remove exactly one add-on line:

```http theme={null}
DELETE /cart/item/6937b6e9e455c711f1fc9064
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
```

## Path parameters

| Parameter   | Type   | Description                                                                                               |
| ----------- | ------ | --------------------------------------------------------------------------------------------------------- |
| `productId` | string | Cart line `_id` (removes that one line), or a product, food, or service id (removes every matching line). |
| `itemId`    | string | Cart line item `_id` (for the `/cart/item/:itemId` route).                                                |

## Headers

| Header          | Type   | Description                                   |
| --------------- | ------ | --------------------------------------------- |
| `Authorization` | string | Provide the customer token as `Bearer <jwt>`. |
| `x-shop-id`     | string | Identify the shop that owns the cart.         |

## Successful response

```json theme={null}
{
    "status": 200,
    "success": true,
    "message": "Cart item removed",
    "data": {
        "_id": "693606ada7a8f7dc8ae32d80",
        "items": [],
        "totalPrice": 0,
        "id": "693606ada7a8f7dc8ae32d80"
    }
}
```

## Error response

```json theme={null}
{
    "status": 404,
    "success": false,
    "message": "Cart item not found",
    "data": {}
}
```

## Remove variant line item

Use this path when removing a specific variant from the cart.

```http theme={null}
DELETE /cart/692cd420b07303c9be5eafd7/692cd420b07303c9be5eafda
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
```

### Additional path parameter

| Parameter   | Type   | Description                                                    |
| ----------- | ------ | -------------------------------------------------------------- |
| `variantId` | string | Variant identifier when removing a specific variant line item. |


## OpenAPI

````yaml DELETE /cart/{productId}
openapi: 3.1.0
info:
  title: Salesive Store API
  description: >-
    REST interface for querying products, categories, and merchandising banners
    exposed by Salesive storefronts.
  version: 1.0.0
servers:
  - description: Production
    url: https://store.salesive.com/api/v1
security:
  - BearerAuth: []
    ShopIdHeader: []
paths:
  /cart/{productId}:
    delete:
      summary: Remove cart item
      description: >-
        Remove cart line(s). The path id may be the cart line `_id` (removes
        exactly that line), or the product, food, or service id (removes every
        line for that item).
      parameters:
        - $ref: '#/components/parameters/XShopIdHeader'
        - $ref: '#/components/parameters/CartProductIdPathParam'
      responses:
        '200':
          description: Cart item removed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CartResponse'
        '404':
          description: Cart item not found.
components:
  parameters:
    XShopIdHeader:
      name: x-shop-id
      in: header
      description: >-
        Optional identifier that scopes responses to a specific storefront when
        the referer cannot be inferred.
      required: false
      schema:
        type: string
    CartProductIdPathParam:
      name: productId
      in: path
      required: true
      description: >-
        Identifier of the cart line to target. Accepts the cart line's own
        `_id`, or the product, food, or service id it holds. A catalog id
        (product/food/service) matches every line for that item — for a food or
        service added with different add-on combinations, target one specific
        line by its `_id` via `/cart/item/{itemId}`.
      schema:
        type: string
  schemas:
    CartResponse:
      type: object
      required:
        - status
        - success
        - message
        - data
      properties:
        status:
          type: integer
          description: HTTP status code returned by the API.
        success:
          type: boolean
          description: Indicates whether the request succeeded.
        message:
          type: string
          description: Human-readable response message.
        data:
          $ref: '#/components/schemas/Cart'
    Cart:
      type: object
      required:
        - _id
        - items
        - totalPrice
      properties:
        _id:
          type: string
          description: Cart identifier.
        user:
          type: string
          description: Identifier of the shopper who owns the cart.
        shop:
          type: string
          description: Identifier of the shop associated with the cart.
        items:
          type: array
          items:
            $ref: '#/components/schemas/CartItem'
        totalPrice:
          type: number
          description: Total price of all items in the cart.
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the cart was created.
        updatedAt:
          type: string
          format: date-time
          description: Timestamp when the cart was last updated.
    CartItem:
      type: object
      required:
        - itemType
        - name
        - image
        - price
        - quantity
      properties:
        _id:
          type: string
        itemType:
          type: string
          enum:
            - product
            - food
            - service
        product:
          type: object
          description: Product or variant metadata for the cart item.
          properties:
            _id:
              type: string
            id:
              type: string
            name:
              type: string
            images:
              type: array
              items:
                type: string
                format: uri
            price:
              type: number
            promoPrice:
              type: number
              nullable: true
            sku:
              type: string
            parentProductId:
              type: string
            variantAttributes:
              type: object
              additionalProperties:
                type: string
        food:
          type: object
          description: Food metadata for a food line item.
          properties:
            _id:
              type: string
            id:
              type: string
            name:
              type: string
            images:
              type: array
              items:
                type: string
                format: uri
            price:
              type: number
            promoPrice:
              type:
                - number
                - 'null'
        foodId:
          type: string
          description: Identifier of the food item when `itemType` is `food`.
        variant:
          type: string
          description: Identifier of the variant if the line item is variant-based.
        name:
          type: string
          description: Display name of the line item.
        image:
          type: string
          format: uri
          description: Primary image for the line item.
        price:
          type: number
          description: Unit price of the line item.
        sku:
          type: string
          description: SKU of the line item, if applicable.
        variantAttributes:
          type: object
          description: Attributes for the selected variant.
          additionalProperties:
            type: string
        quantity:
          type: integer
          minimum: 1
          description: Quantity of the line item in the cart.
        selectedAddons:
          type: array
          items:
            $ref: '#/components/schemas/SelectedAddon'
          description: Snapshot of selected add-ons for food items.
    SelectedAddon:
      type: object
      required:
        - addonId
        - name
        - price
        - quantity
      properties:
        addonId:
          type: string
        name:
          type: string
        description:
          type: string
        price:
          type: number
        quantity:
          type: integer
          minimum: 1
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT issued by the Salesive Store API for authenticated shoppers.
    ShopIdHeader:
      type: apiKey
      in: header
      name: x-shop-id
      description: >-
        Optional storefront identifier sent as a header to scope responses to a
        specific shop. Try It requests remember this value once provided.

````