ShoppingCart

Represents a customer's shopping cart containing products before checkout.

Entity (Aggregate Root)

Overview

The ShoppingCart entity manages the customer’s shopping experience before checkout. It tracks selected products, quantities, pricing, and supports both registered customer and guest shopping scenarios.

Entity Properties

Name Type Required Description
cartIdUUID Required Unique identifier for the shopping cart
customerIdUUID Optional Customer who owns this cart (null for guest carts)
sessionIdstring Optional Session identifier for guest carts
statusstring
Enum:
  • active
  • abandoned
  • converted
  • expired
Required Current status of the cart
cartItems array<CartItem > Optional Items in the shopping cart
subtotaldecimal Required Subtotal amount before taxes and shipping
taxAmountdecimal Optional Calculated tax amount
shippingAmountdecimal Optional Calculated shipping amount
discountAmountdecimal Optional Total discount amount applied
totalAmountdecimal Required Final total amount including taxes and shipping
currencystring Required Currency code for all amounts
appliedCoupons array<string > Optional Coupon codes applied to this cart
shippingAddressAddress Optional Selected shipping address
billingAddressAddress Optional Selected billing address
notesstring Optional Customer notes or special instructions
abandonedAtDateTime Optional Date and time when cart was abandoned
convertedToOrderIdUUID Optional Order ID if cart was successfully converted
expiresAtDateTime Optional Date and time when cart expires
createdAtDateTime Required Date and time when the cart was created
updatedAtDateTime Optional Date and time when the cart was last updated

Relationships

  • Customer: A cart can belong to one Customer (identified by customerId).
  • CartItem: A cart contains multiple CartItem entities with product details.
  • Address: A cart can reference shipping and billing Address entities.
  • Order: A cart can be converted to one Order (identified by convertedToOrderId).

Cart States

active → abandoned
↓ ↓
converted expired

Examples

  • Cart #1: Customer cart with 3 items, $299.99 total, active status.
  • Cart #2: Guest cart abandoned after 24 hours, contains 1 high-value item.
  • Cart #3: Converted cart that became Order #12345, marked as converted.

Business Rules

  • Guest carts are identified by session ID when customer ID is null
  • Cart totals are recalculated when items are added/removed
  • Abandoned carts trigger marketing automation after configured time
  • Expired carts are cleaned up after retention period
  • Cart conversion creates an order and marks cart as converted
  • Inventory is not reserved until checkout begins
  • Applied coupons are validated on each cart update
  • Cart items maintain snapshot of product prices at time of addition