> For the complete documentation index, see [llms.txt](https://docs.liquidcommerce.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.liquidcommerce.cloud/events-and-errors/cart-events.md). Agents can also search and read this documentation through its [MCP server](https://docs.liquidcommerce.cloud/~gitbook/mcp).

# Cart Events

Cart events indicate various cart states and conditions. The system maintains fault tolerance by returning events instead of failing operations.

### Event Structure

```typescript
interface ICartEvent {
  type: CART_EVENT_ENUM;
  message: string;
  items?: Array<Partial<ICartItem>>;
}
```

### Event Enum

{% code collapsedlinecount="10" %}

```typescript
enum CART_EVENT_ENUM {
  OOS = 'OutOfStock',
  PRESALE_LIMIT_EXCEEDED = 'PresaleLimitExceeded',
  PRESALE_NOT_STARTED = 'PresaleNotStarted',
  PRESALE_EXPIRED = 'PresaleExpired',
  PRESALE_MIXED_CART = 'PresaleMixedCart',
  PRESALE_ALREADY_IN_CART = 'PresaleAlreadyInCart',
  PRESALE_NOT_FOUND = 'PresaleNotFound',
  PRESALE_EXCLUDED_FROM_DISCOUNT = 'PresaleExcludedFromDiscount',
  ITEMS_REQUESTED_NOT_ADDED = 'ItemsRequestedNotAdded',
  ITEM_NOT_ENGRAVED = 'ItemEngravingError',
  ADDRESS_CHANGE = 'AddressChange',
  REMOVED_EXISTING_ITEMS = 'RemovedExistingCartItems',
  RETAILER_MIN = 'RetailerMinNotMet',
  NO_ITEMS_IN_CART = 'NoItemsInCart',
  INVALID_ID = 'InvalidId',
  NO_ID = 'NoId',
  CART_CHECKOUT_PROCESSED = 'CartCheckoutProcessed',
  NEW_CART = 'NewCart',
  DEFAULT = 'CartError',
  ITEM_QTY_CHANGE = 'ItemQuantityChange',
  ITEM_ID_NOT_FOUND = 'ItemIdNotFound',
  ITEMS_REMOVED = 'ItemsRemoved',
  RETAILER_FULFILLMENT_INVALID = 'RetailerFulfillmentInvalid',
  MAX_QUANTITY_PER_ORDER_EXCEEDED = 'MaxQuantityPerOrderExceeded',
  RETAILER_ONDEMAND_HOURS_NOT_AVAILABLE = 'RetailerOnDemandHoursNotAvailable',
  COUPON_PROCESSING_ERROR = 'CouponProcessingError',
  COUPON_NOT_FOUND = 'CouponNotFound',
  COUPON_EXPIRED = 'CouponExpired',
  NO_APPLICABLE_DISCOUNT = 'NoApplicableDiscount',
  COUPON_NOT_STARTED = 'CouponNotStarted',
  MINIMUM_ORDER_VALUE_NOT_MET = 'MinimumOrderValueNotMet',
  MINIMUM_ORDER_UNITS_NOT_MET = 'MinimumOrderUnitsNotMet',
  MINIMUM_DISTINCT_ITEMS_NOT_MET = 'MinimumDistinctItemsNotMet',
  QUOTA_EXCEEDED = 'QuotaExceeded',
  NOT_FIRST_PURCHASE = 'NotFirstPurchase',
  INVALID_COUPON = 'InvalidCoupon',
  INVALID_MEMBERSHIP = 'InvalidMembership',
  INVALID_DOMAIN = 'InvalidDomain',
  INVALID_REQUIREMENTS = 'InvalidRequirements',
  INVALID_ORGANIZATION = 'InvalidOrganization',
  PRESALE_ITEMS_NOT_ALLOWED = 'PresaleItemsNotAllowed',
  PRODUCT_NOT_ELIGIBLE = 'ProductNotEligible',
  NOT_ENOUGH_PREVIOUS_ORDERS = 'NotEnoughPreviousOrders',
  RETAILER_DOES_NOT_ALLOW_PROMOS = 'RetailerDoesNotAllowPromos',
  RETAILERS_DO_NOT_ALLOW_PROMOS = 'RetailersDoNotAllowPromos',
  RETAILER_DOES_NOT_ALLOW_GIFT_CARDS = 'RetailerDoesNotAllowGiftCards',
  RETAILERS_DO_NOT_ALLOW_GIFT_CARDS = 'RetailersDoNotAllowGiftCards',
}
```

{% endcode %}

### Event Types

#### Inventory Events

* `OutOfStock`: Requested items are not available in the desired quantity

#### Cart Modification Events

* `ItemsNotAdded`: Products could not be added to the cart
* `ItemsRequestedNotAdded`: These item(s) requested can't be added to the cart either due to the location provided, and/or hours of operation.
* `RemovedExistingCartItems`: The following cart item(s) have been removed, they're currently not available in the location provided
* `ItemQuantityChange`: Item quantity reduced from ${originalQuantity} to ${stock} due to limited stock availability
* `ItemsRemoved`: The following item(s) were removed from the cart due to zero quantity

#### Validation Events

* `RetailerMinNotMet`: The retailer minimum was not met, for item(s) (quantity:${quantity}, total price: ${price}) min(${min}).
* `NoItemsInCart`: Cart is empty
* `InvalidId`: The cartId provided is invalid, a new cart was created
* `NoId`: The cartId provided is empty, a new cart was created
* `PresaleLimitExceeded`: Presale fully reserved || Only ${n} units remaining for presale
* `PresaleNotStarted:` Presale starts at ${date}
* `PresaleExpired:`  Presale reservation has expired || This presale has ended
* `PresaleMixedCart:` Presale items cannot be mixed with regular items
* `PresaleAlreadyInCart:` Only one presale can be in the cart. Items of another presale were removed.
* `PresaleNotFound:` Presale configuration not found!
* `RetailerFulfillmentInvalid:`  The retailer fulfillment ${fulfillmentId} selected, for item(s) with quantity:${quantity}, is invalid due to the fulfillment's allowed product type ${productTypesAllowed}.
* `MaxQuantityPerOrderExceeded:` The maximum quantity per order for this item is ${maxPresaleQuantity}. Quantity has been adjusted accordingly. || Quantity adjusted from ${originalQuantity} to ${quantity} due to presale availability
* `RetailerOnDemandHoursNotAvailable:` The following cart item(s) have been removed due to retailer hours of operation restrictions

#### State Change Events

* `AddressChange`: The provided location does not match the cart's location
* `CartCheckoutProcessed`: The cartId (${id}) provided has already been processed through a checkout successfully
* `NewCart`: No cart was found with the cartId (${id}), a new cart was created

#### Special Cases

* `CartError`: Default error event
* `ItemIdNotFound`: The following item(s) with provided id were not found in the cart
* `ItemEngravingError:`  The item(s) selected for engraving is not engravable. || The item(s) selected for engraving is not currently active for engraving. || The item(s) selected for engraving has exceeded the maximum(${maxLines}) number of engraving lines. || The item(s) selected for engraving has exceeded the maximum(${engravingPersonalization.maxCharsPerLine}) characters limit per line.

#### Coupon Event Cases

* `CouponProcessingError:`  There was an error processing this coupon
* `CouponNotFound:`  This coupon does not exist
* `CouponExpired:`  This coupon has expired
* `InvalidCoupon:` This coupon is invalid
* `NoApplicableDiscount:`  This coupon results in no discount
* `CouponNotStarted:`  This coupon is not yet active
* `MinimumOrderValueNotMet:`  Order total does not meet minimum required value
* `MinimumOrderUnitsNotMet:`  Order does not meet minimum quantity requirement
* `MinimumDistinctItemsNotMet:`  Order does not meet minimum unique items requirement
* `QuotaExceeded:`  This coupon has reached its usage limit
* `UserLimitExceeded:`  Default error event
* `NotFirstPurchase:`  This coupon is only valid for first purchases
* `InvalidMembership:`  This coupon requires a specific membership
* `InvalidDomain:`  This coupon is restricted to specific email domains
* `InvalidRequirements:`  This coupon does not meet the required conditions
* `InvalidOrganization:`  This coupon is restricted to specific organizations
* `PresaleItemsNotAllowed:`  This coupon cannot be used with presale items
* `PresaleExcludedFromDiscount:` This coupon does not apply to pre-order items.
* `ProductNotEligible:`  One or more items are not eligible for this coupon
* `NotEnoughPreviousOrders:`  Previous order requirement not met
* `RetailerDoesNotAllowPromos:` This retailer does not accept promo codes
* `RetailersDoNotAllowPromos:`  Selected retailers do not accept promo codes<br>

Checkout Only Event Cases

* `RetailerDoesNotAllowGiftCards:`  Gift card applied. Note: ${retailerNames} does not accept gift cards || Gift card applied to eligible retailers only. The following retailers do not accept gift cards: ${retailerNames}
* `RetailersDoNotAllowGiftCards:`  ${retailerNames} does not accept gift cards || None of the selected retailers accept gift cards
