ShoppingCart (v1.0.0)

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

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

NameTypeRequiredDescription
cartIdUUIDRequiredUnique identifier for the shopping cart
customerIdUUIDOptionalCustomer who owns this cart (null for guest carts)
sessionIdstringOptionalSession identifier for guest carts
statusstringRequiredCurrent status of the cart
cartItemsarrayOptionalItems in the shopping cart
subtotaldecimalRequiredSubtotal amount before taxes and shipping
taxAmountdecimalOptionalCalculated tax amount
shippingAmountdecimalOptionalCalculated shipping amount
discountAmountdecimalOptionalTotal discount amount applied
totalAmountdecimalRequiredFinal total amount including taxes and shipping
currencystringRequiredCurrency code for all amounts
appliedCouponsarrayOptionalCoupon codes applied to this cart
shippingAddressAddressOptionalSelected shipping address
billingAddressAddressOptionalSelected billing address
notesstringOptionalCustomer notes or special instructions
abandonedAtDateTimeOptionalDate and time when cart was abandoned
convertedToOrderIdUUIDOptionalOrder ID if cart was successfully converted
expiresAtDateTimeOptionalDate and time when cart expires
createdAtDateTimeRequiredDate and time when the cart was created
updatedAtDateTimeOptionalDate 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