Cart Events

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

Event Structure

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

Event Enum

enum CART_EVENT_ENUM {
  OOS = 'OutOfStock',
  PRESALE_LIMIT_EXCEEDED = 'PresaleLimitExceeded',
  PRESALE_NOT_STARTED = 'PresaleNotStarted',
  PRESALE_EXPIRED = 'PresaleExpired',
  PRESALE_MIXED_CART = 'PresaleMixedCart',
  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',
}

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

  • 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

  • ProductNotEligible: One or more items are not eligible for this coupon

  • NotEnoughPreviousOrders: Previous order requirement not met

Last updated