---
title: Cart
slug: cart
abstract: The Cart API simplifies shopping experience development through streamlined endpoints.
content_type: concept
audience: \[developer]
---
# Cart

The Cart API simplifies shopping experience development through streamlined endpoints. This enhancement provides direct cart interaction while supporting both single-cart and multi-cart implementations.

## Implementation benefits

Previous workflow (without Cart API):

1. `GET v1/orders/{direction}?Status=Unsubmitted&SortBy=!DateCreated`
2. Process most recent Order ID
3. Create order if none exists
4. Add line items

Simplified workflow (with Cart API):

1. `POST v1/cart/lineitems`

## Key features

Core functionality:

- Represents unsubmitted orders
- Proxies actions to corresponding orders
- Returns empty structures instead of null/404:
  - Empty order with null ID
  - Empty line item list
- Supports immediate or deferred order creation
- Automatic order creation with line item addition

## Implementation patterns

### Single cart implementation

Standard workflow:

1. Initial load: `GET v1/cart` for item count
2. Add items: `POST v1/cart/lineitems`
3. Prepare cart: `POST v1/cart/payments`, `POST v1/cart/validate`
4. Submit order: `POST v1/cart/submit`

Implementation note: Use Cart endpoints instead of Order endpoints to prevent multiple unsubmitted orders. System selects most recent unsubmitted order as active cart.

### Multi-cart implementation

Extended workflow:

1. List unsubmitted orders:

   ```http
   GET v1/orders/{direction}?Status=Unsubmitted
   ```

2. Create orders if needed:
   - `POST v1/orders/{direction}`
   - `PUT v1/orders/{direction}/{orderID}`

3. Designate active cart:

   ```http
   PUT v1/cart/ABC
   ```

4. Add items to first cart:

   ```http
   POST v1/cart/lineitems
   ```

5. Switch active cart:

   ```http
   PUT v1/cart/123
   ```

6. Add items to second cart:

   ```http
   POST v1/cart/lineitems
   ```

7. Prepare cart:
   - Add payments
   - Validate order

8. Submit order:

   ```http
   POST v1/cart/submit
   ```

Implementation notes:

- Remaining unsubmitted orders become active cart
- Use `PUT v1/cart/{orderID}` for specific cart selection
- Anonymous shopping does not support multi-cart

## Available endpoints

Cart endpoints proxy to Order endpoints with simplified interaction:

| Endpoint | Order equivalent | Purpose |
| ---------- | ----------------- | ---------- |
| `GET v1/cart` | `GET v1/orders/outgoing?PageSize=1&Status=Unsubmitted&SortBy=!DateCreated` | Retrieve cart |
| `PUT v1/cart` | `POST v1/orders/outgoing` or `PUT v1/orders/outgoing/{orderID}` | Create/update cart |
| `PUT v1/cart/{orderID}` | None | Set active cart |
| `PATCH v1/cart` | `PATCH v1/orders/outgoing/{orderID}` | Partial cart update |
| `DELETE v1/cart` | `DELETE v1/orders/outgoing/{orderID}` | Remove cart |

### Line item operations

| Endpoint | Purpose |
| ---------- | ---------- |
| `GET v1/cart/lineitems` | List items |
| `GET v1/cart/lineitems/{lineitemID}` | Get specific item |
| `POST v1/cart/lineitems` | Add item |
| `PUT v1/cart/lineitems/{lineitemID}` | Create/update item |
| `PATCH v1/cart/lineitems/{lineitemID}` | Partial item update |
| `DELETE v1/cart/lineitems/{lineitemID}` | Remove item |

### Cart processing

| Endpoint | Purpose |
| ---------- | ---------- |
| `GET v1/cart/worksheet` | Get order details |
| `POST v1/cart/estimateshipping` | Calculate shipping |
| `POST v1/cart/shipmethods` | Set shipping method |
| `PUT v1/cart/shipto` | Set shipping address |
| `PUT v1/cart/billto` | Set billing address |
| `POST v1/cart/calculate` | Update totals |

### Payment handling

| Endpoint | Purpose |
| ---------- | ---------- |
| `GET v1/cart/payments` | List payments |
| `POST v1/cart/payments` | Add payment |
| `PATCH v1/cart/payments/{paymentID}` | Update payment |
| `DELETE v1/cart/payments/{paymentID}` | Remove payment |
| `POST v1/cart/payments/{paymentID}/transactions` | Process payment |

### Promotion management

| Endpoint | Purpose |
| ---------- | ---------- |
| `GET v1/cart/promotions` | List promotions |
| `POST v1/cart/promotions/{promoCode}` | Apply promotion |

### Order completion

| Endpoint | Purpose |
| ---------- | ---------- |
| `PATCH v1/cart/fromuser` | Update user details |
| `POST v1/cart/validate` | Verify cart |
| `POST v1/cart/submit` | Complete order |

## Related reading

- [API client secrets](https://doc.sitecore.com/ordercloud/en/developers/platform/api-client-secrets.html)
- [Introduction to API clients](https://doc.sitecore.com/ordercloud/en/developers/platform/api-clients.html)
- [Introducing order returns](https://doc.sitecore.com/ordercloud/en/developers/platform/order-returns.html)


