Shopping cart schema with support for guest and authenticated users.
Status Lifecycle
active- Cart is active and can be modifiedmerged- Guest cart was merged into user cart after loginconverted- Cart was converted to an orderabandoned- 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.
Summary
Functions
Returns true if cart is active.
Changeset for cart creation and updates.
Returns true if cart can be converted to order.
Returns true if cart is empty.
Returns true if cart has expired.
Returns true if cart is a guest cart (no user_uuid).
Changeset for setting payment option.
Changeset for setting shipping.
Changeset for status transitions.
Returns list of valid status values.
Changeset for updating cart totals.
Functions
Returns true if cart is active.
Changeset for cart creation and updates.
Returns true if cart can be converted to order.
Returns true if cart is empty.
Returns true if cart has expired.
Returns true if cart is a guest cart (no user_uuid).
Changeset for setting payment option.
Changeset for setting shipping.
Changeset for status transitions.
Returns list of valid status values.
Changeset for updating cart totals.