Skip to content

Data & Storage

CartBay stores recovery sessions as WooCommerce orders. There are no custom recovery-session database tables in v1.

A CartBay session is a WooCommerce order with:

  • created_via set to cartbay.
  • Billing email set to the captured checkout email.
  • A CartBay lifecycle status.
  • CartBay metadata prefixed with _cartbay_.
StatusMeaning
wc-cartbay-capturedShopper consented and the cart was captured.
wc-cartbay-abandonedCaptured session exceeded the inactivity timeout.
wc-cartbay-recoveredA later order matched the abandoned session.
wc-cartbay-expiredSession passed retention or was expired.
wc-cartbay-suppressedShopper unsubscribed or was suppressed.
Meta keyPurpose
_cartbay_session_idCartBay session identity.
_cartbay_email_hashNormalized email hash for grouping and fallback attribution.
_cartbay_emailCaptured email. Use carefully; this is PII.
_cartbay_consent, _cartbay_consent_text, _cartbay_consent_atConsent state and context.
_cartbay_sourceclassic or block.
_cartbay_cart_hash, _cartbay_cart_fingerprintCart identity and dedupe/update inputs.
_cartbay_cart_total, _cartbay_currency, _cartbay_cart_item_countCart value summary.
_cartbay_cart_snapshotRestore-ready cart snapshot.
_cartbay_captured_at, _cartbay_last_activity_at, _cartbay_abandoned_atLifecycle timestamps.
_cartbay_recovered_at, _cartbay_recovered_order_id, _cartbay_recovered_revenueRecovery attribution.
_cartbay_eventsStructured session event log.
_cartbay_notificationsNotification lifecycle records.
_cartbay_token_hash, _cartbay_token_hashes, _cartbay_token_expires_atRestore token hashes and expiry.
_cartbay_unsub_token_hashUnsubscribe token hash.
_cartbay_coupon_code, _cartbay_coupon_expires_atGenerated recovery coupon context.

Implemented session events include captured, updated, abandoned, email_sent, email_failed, restore_clicked, cart_restore_started, cart_restored, cart_restore_partial, cart_restore_failed, completed_before_abandonment, recovered, and unsubscribed.

OptionPurpose
cartbay_settingsCapture, consent, timeout, offers, retention, logs, test mode, admin navigation, and agent gates.
cartbay_campaign_settingsRecovery sequence enabled state, delay settings, and per-step coupon controls.
cartbay_license_dataStored license key and license status data.
cartbay_wizard_completeFirst-run wizard completion flag.
cartbay_sequence_defaults_versionSequence default migration marker.
TransientPurpose
cartbay_license_validCached license validity for 12 hours.
cartbay_analytics_cacheCached analytics metrics.
cartbay_rl_{endpoint}_{md5(REMOTE_ADDR)}Public endpoint rate-limit counters.
cartbay_notification_ctx_{notification_id}Notification context for mail success/failure hooks.
cartbay_wizard_redirectShort-lived first-run redirect flag.

Suppression entries use a private cartbay_suppressed post type. The post slug/title is the SHA-256 hash of the normalized email. This allows suppression lookup without storing a plain email in the suppression identifier.

CartBay creates recovery coupons with WC_Coupon. Coupon metadata includes _cartbay_session_id, _cartbay_email, _cartbay_generated, and _cartbay_offer_note.

Retention is controlled by cartbay_settings['data_retention_days']. The daily cartbay_prune_sessions action delegates cleanup to SessionRepository::prune_expired().