Skip to content

Hooks & Jobs

CartBay is event-driven. Most behavior is registered from Core/Plugin.php and executed through WordPress, WooCommerce, and Action Scheduler hooks.

HookPurpose
before_woocommerce_initDeclare HPOS compatibility.
initRegister custom statuses, private CPTs, restore/unsubscribe handlers.
woocommerce_register_shop_order_statusesRegister CartBay statuses with WooCommerce.
wc_order_statusesAdd CartBay statuses to status lists.
rest_api_initRegister REST routes.
admin_menuRegister WooCommerce menu shortcut and hidden wizard page.
admin_initHandle wizard redirect.
HookPurpose
wp_enqueue_scriptsEnqueue classic checkout capture asset when eligible.
woocommerce_blocks_enqueue_checkout_block_scripts_afterEnqueue Block Checkout capture asset.
woocommerce_initRegister Block Checkout additional consent field.
woocommerce_get_default_value_for_cartbay/marketing-consentReturn configured default checkbox state.
woocommerce_checkout_get_valuePrefill restored checkout email.
wpDisplay frontend notices after restore.
HookPurpose
woocommerce_payment_completeAttempt recovery matching after payment completion.
woocommerce_order_status_changedAttempt matching when order becomes processing/completed.
woocommerce_checkout_create_orderAttach CartBay attribution identity to the new order.
woocommerce_coupon_is_validValidate CartBay-generated coupons against restored identity.
HookPurpose
woocommerce_email_classesRegister CartBay recovery email classes.
wp_mail_failedMark notification failures and retry when applicable.
wp_mail_succeededMark notifications sent when WordPress accepts mail.
cartbay_mark_notification_deliveredOptional provider integration hook for confirmed delivery.

Recurring jobs in group cartbay:

HookSchedulePurpose
cartbay_detect_abandonmentEvery 5 minutesFallback scanner for inactive captured sessions.
cartbay_refresh_analyticsHourlyRefresh analytics cache.
cartbay_prune_sessionsDailyPrune expired sessions.
cartbay_check_licenseDailyRefresh license state.

Single jobs in group cartbay:

HookArgsPurpose
cartbay_detect_session_abandonment[session_id]Exact abandonment boundary check.
cartbay_send_recovery_email[session_id, step_index]Send one recovery email step.

Known extension filters include:

FilterPurpose
cartbay_mail_delivery_pluginsExtend known mail delivery plugin detection.
cartbay_email_logger_pluginsExtend known email logger detection.
cartbay_mail_environment_statusOverride or enrich detected mail environment status.
cartbay_license_dev_domain_bypassControl development-domain license bypass behavior.
  • Prefer adding hooks around service boundaries instead of bypassing services.
  • Keep recovery job callbacks idempotent.
  • Do not schedule duplicate Action Scheduler actions; check existing actions first.
  • Keep all order access HPOS-safe through WooCommerce CRUD.
  • Treat public REST and agent input as untrusted.