# `PhoenixKitEcommerce.Cart`
[🔗](https://github.com/BeamLabEU/phoenix_kit_ecommerce/blob/v0.1.8/lib/phoenix_kit_ecommerce/schemas/cart.ex#L1)

Shopping cart schema with support for guest and authenticated users.

## Status Lifecycle

- `active` - Cart is active and can be modified
- `merged` - Guest cart was merged into user cart after login
- `converted` - Cart was converted to an order
- `abandoned` - Cart was marked as abandoned (no activity)
- `expired` - Cart expired (past expires_at)

## Identity

Each cart has either `user_uuid` (for authenticated users) or `session_id` (for guests).
Guest carts have an `expires_at` timestamp (30 days by default).
When a guest logs in, their cart is either converted to a user cart or merged
with an existing user cart.

# `active?`

Returns true if cart is active.

# `changeset`

Changeset for cart creation and updates.

# `convertible?`

Returns true if cart can be converted to order.

# `empty?`

Returns true if cart is empty.

# `expired?`

Returns true if cart has expired.

# `guest?`

Returns true if cart is a guest cart (no user_uuid).

# `payment_changeset`

Changeset for setting payment option.

# `shipping_changeset`

Changeset for setting shipping.

# `status_changeset`

Changeset for status transitions.

# `statuses`

Returns list of valid status values.

# `totals_changeset`

Changeset for updating cart totals.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
