---
title: "Cart"
description: "How EdgeCart holds line items, calculates totals, and applies plugin adjustments before checkout."
---

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

# Cart

The Cart module represents a shopper's intent to buy before an order exists. It
collects line items, keeps the customer and region context, and calculates the
totals shown at checkout.

## Features

- **Cart lifecycle** — create, retrieve, update, and complete a cart.
- **Line items** — add a variant with a quantity and keep a snapshot of its
  price.
- **Totals** — subtotal, discount, tax, shipping, and grand total in minor units.
- **Adjustments** — promotion discounts and plugin-proposed adjustments applied
  to lines or the cart.
- **Cart context** — the region, customer, and sales channel that determine
  pricing, tax, and availability.

## Key concepts

| Concept | What it means |
|---|---|
| Cart | A pending purchase with line items and totals. |
| Line item | One variant in the cart, with a quantity and a snapshotted unit price. |
| Adjustment | A discount or surcharge attached to a line item, shipping, or the cart. |
| Totals | The calculated subtotal, discount, tax, shipping, and grand total. |
| Cart context | The region, customer, and sales channel used to resolve prices and taxes. |

## How it fits

- **Storefront** — the shop keeps the guest cart in `sessionStorage` and syncs it
  through the Store API. Signed-in customers have a server-backed cart.
- **Catalog** — supplies the variant price and inventory when a line is added or
  updated.
- **Sales** — supplies the region, customer group, promotions, and tax context.
- **Payments** — a payment collection and session are created for the cart at
  checkout.
- **Orders** — completing a paid cart creates the order.
- **Plugins** — plugins can propose cart adjustments through hooks; the host
  recalculates totals rather than trusting plugin arithmetic.

> **Line prices are snapshotted**
>
> A cart line keeps the price it had when it was added or last updated, and when
> the cart's customer or region changes. Later catalog or price-list changes do
> not retroactively reprice existing lines.

## Common tasks

- **Merchant** — the cart is the shopper's view of your catalog. See the
  [merchant guide](https://edgecart.dev/merchants/) for product and store setup.
- **Developer** — use the Store API operations in the [API reference](https://edgecart.dev/api), and
  read [API conventions](https://edgecart.dev/reference/api-conventions) for money and idempotency.

## Related modules

- [Catalog](https://edgecart.dev/modules/catalog) — product prices and inventory.
- [Sales](https://edgecart.dev/modules/sales) — regions, customers, promotions, and tax.
- [Orders](https://edgecart.dev/modules/orders) — checkout creates an order.
- [Payments](https://edgecart.dev/modules/payments) — payment sessions for the cart.

Source: https://edgecart.dev/modules/cart/index.mdx
