---
title: "Cart commands and pipelines"
slug: "cart-commands-and-pipelines"
abstract: ""
---
# Cart commands and pipelines

The following table describes the commands and pipelines pertaining to the Cart entity:

| Command/Pipeline | Description |
| --- | --- |
| `GetCartCommand`<br><br>`GetCartPipeline` | Retrieves the cart record. If the cart does not exist it returns an empty cart.<br><br>Parameter:<br><br><ul><li>`cartId`: the cart identifier (string)</li></ul><br><br>> [!note]<br>> By default, the `GetCartPipeline` recalculates the cart. In scenarios where cart calculation is not required, you can by-pass that cart calculation by including `DoNotCalculateCart` in the `PolicyKeys` header of the `GetCart` request. |
| `MergeCartsCommand`<br><br>`MergeCartsPipeline` | Merges two cart records. For example a customer initially creates a cart as an anonymous user, then authenticates and creates another cart. This action merges the previously anonymous cart into the authenticated cart and recalculates the cart.<br><br>Parameters:<br><br><ul><li>`fromCartId`: cart record that data is merged from (string)</li><li>`toCartId`: cart record that data is merged to (string)</li></ul> |
| `AddCartLinesCommand`<br><br>`AddCartLinesPipeline` | Adds new cart lines but only re-calculates the cart once instead of for each line item added. When free gifts are added, the `SelectFreeGiftsComponent` is removed.<br><br>Parameters:<br><br><ul><li>`cartId`: unique identifier for the cart.</li><li>`itemId: identifier to the sellable item in the form <catalog>\|<product_id>\|<variant_id>`</li><li>`quantity`: the quantity of cart line items to add (decimal).</li><li>`isFreeGift`: (optional) true if a free gift is being added, otherwise false (or omitted).</li><li>`subLines`: sub-lines to be added as part of line items.  Used for both static and dynamic bundles.</li></ul> |
| `AddEmailToCartCommand`<br><br>`AddEmailToCartPipeline` | Adds the shopper email to the cart.<br><br>Parameters:<br><br><ul><li>`cartID`: the unique identifier for the cart.</li><li>`email`: email address associated with the cart.</li></ul> |
| `UpdateCartLineCommand`<br><br>`UpdateCartLinePipeline` | Updates a cart line within a Cart, for example updates its identifier or quantity, and recalculates the cart.<br><br>Parameters:<br><br><ul><li>`cartId`: the unique identifier for the cart (string)</li><li>`cartLineId`: the unique identifier for the cart line (string)</li><li>`quantity`: the quantity of cart line items to add (decimal)</li></ul> |
| `RemoveCartLineCommand`<br><br>`RemoveCartLinePipeline` | Removes a single cart line from a Cart. Recalculates the cart.<br><br>Parameters:<br><br><ul><li>`cartId`: the unique identifier for the cart (string)</li><li>`cartLineId`: the unique identifier for the cart line (string)</li></ul> |

The following are general pipelines that extend other cart pipelines:

- `CalculateCartPipeline`
- `CalculateCartLinesPipeline`
- `GetCartPipeline`
- `GetCartListPipeline`
- `PopulateLineItemPipeline`
- `PopulateValidateCartPipeline`