Hooks & Filters

Updated on February 9, 2026

This page documents all the WordPress action hooks, AJAX endpoints, and custom cron schedules registered by the plugin. Use this as a reference when debugging, extending, or integrating with the plugin’s behavior.

WordPress Action Hooks

The plugin hooks into the following WordPress and WooCommerce actions to trigger sync operations and render UI elements.

Contact Sync Hooks

These hooks fire when the Contact Sync module is enabled and auto-sync on registration is turned on.

HookPriorityDescription
woocommerce_created_customer10Syncs a newly registered WooCommerce customer to Mautic.
user_register10Syncs a newly registered WordPress user to Mautic.
profile_update10Syncs updated user profile data to Mautic.

Registration Consent Hooks

These hooks fire when the consent checkbox feature is enabled in Contact Sync settings.

HookPriorityDescription
woocommerce_register_form10Renders the marketing consent checkbox on the WooCommerce registration form.
register_form10Renders the marketing consent checkbox on the WordPress registration form.
woocommerce_created_customer5Saves the consent checkbox value to user meta when a WooCommerce customer registers.
user_register5Saves the consent checkbox value to user meta when a WordPress user registers.

Order Sync Hooks

These hooks fire when the Order Sync module is enabled.

HookPriorityDescription
woocommerce_order_status_changed99Triggers order data sync to Mautic when an order status changes. Sends contact data, order JSON, tags, lifetime value, optional notes, and optional email triggers.
woocommerce_subscription_status_updated100Handles WooCommerce Subscriptions status updates (requires WooCommerce Subscriptions plugin).

Abandoned Cart Hooks

These hooks fire when the Abandoned Cart module is enabled.

HookPriorityDescription
wp_enqueue_scripts10Enqueues the abandoned cart capture JavaScript and CSS on the checkout page.
woocommerce_after_checkout_billing_form10Renders the GDPR consent checkbox on the checkout page (when GDPR is enabled and silent capture is off).
template_redirect10Handles cart recovery URLs (?mautic_woo_recover=TOKEN). Restores the cart contents and redirects to checkout.
woocommerce_checkout_order_processed10Marks abandoned carts as recovered when an order is placed with a matching email address.

Authentication Hooks

HookPriorityDescription
admin_init10Handles the OAuth2 callback when Mautic redirects back with an authorization code.

Admin and UI Hooks

HookPriorityDescription
admin_menu10Registers the settings page under WooCommerce and the top-level Mautic WooCommerce admin menu.
admin_enqueue_scripts10Enqueues admin CSS and JavaScript on the plugin settings pages.
admin_notices10Displays admin notices for requirements checks (PHP version, WooCommerce missing) and transient notices.

Frontend Asset Hooks

HookPriorityDescription
wp_enqueue_scripts10Registers the subscribe form JavaScript and CSS (loaded only when the shortcode is used).
wp_enqueue_scripts10Enqueues the form capture JavaScript on all frontend pages (when Form Capture is enabled).

Cron Filter

FilterDescription
cron_schedulesRegisters a custom fifteen_minutes cron interval (900 seconds) used by the abandoned cart processor.

AJAX Endpoints

All AJAX endpoints are registered through the plugin’s Ajax class. Each endpoint requires a valid nonce (mautic_woo_nonce) passed as the nonce POST parameter. Admin-only endpoints also require the manage_woocommerce capability. Responses are returned as JSON via wp_send_json_success() or wp_send_json_error().

Connection

Action NameAccessDescription
mautic_woo_test_connectionAdmin onlyTests the connection to the configured Mautic instance by fetching a single contact. Returns success status and total contact count.

Mautic Fields

Action NameAccessDescription
mautic_woo_check_fieldsAdmin onlyChecks which required custom fields exist in Mautic. Returns a status map of field aliases (mautic_woo_order_data, mautic_woo_cart_data, mautic_woo_recovery_url, mautic_woo_total_spent, mautic_woo_order_count, mautic_woo_coupon_code) with boolean values.
mautic_woo_create_fieldsAdmin onlyCreates all required custom fields in Mautic that do not already exist. Returns the count of fields created and any errors.

Bulk Sync

Action NameAccessDescription
mautic_woo_start_bulk_syncAdmin onlyStarts a bulk sync of all WooCommerce users to Mautic. Initializes the sync state transient and returns the total user count.
mautic_woo_bulk_sync_statusAdmin onlyReturns the current bulk sync progress (total, synced, errors, status). If the sync is running, it also processes the next batch of 5 users before returning the updated progress.
mautic_woo_cancel_bulk_syncAdmin onlyCancels an in-progress bulk sync and unschedules any pending cron batch.
mautic_woo_preview_bulk_syncAdmin onlyReturns a preview of the mapped data for the first 10 users without actually syncing them.

Subscribe Form

Action NameAccessDescription
mautic_woo_subscribePublic (nopriv)Handles subscribe form submissions. Accepts email and optional tag POST parameters. Creates or updates a contact in Mautic with the email address and applies the specified tag along with the default tag from settings. This endpoint is available to both logged-in and logged-out users.

Abandoned Cart

Action NameAccessDescription
mautic_woo_capture_cartPublic (nopriv)Captures cart data from the checkout page via AJAX. Saves or updates the cart contents, email, session ID, and GDPR consent status to the abandoned carts database table. This endpoint is available to both logged-in and logged-out users.

Tools

Action NameAccessDescription
mautic_woo_migrate_wooticAdmin onlyMigrates settings from the legacy Wootic plugin. Reads old mautic_woocommerce_settings_* options and maps them into the new unified settings format. Returns the count of migrated settings.
mautic_woo_cleanup_legacyAdmin onlyDeletes all legacy Wootic settings options from the database after migration. Returns the count of deleted options.
mautic_woo_clear_sync_logAdmin onlyTruncates the sync log database table, removing all entries.
mautic_woo_get_sync_logAdmin onlyRetrieves paginated sync log entries. Accepts page and per_page POST parameters (default: page 1, 25 per page, max 100). Returns rows, total count, current page, and total pages.

Custom Cron Schedules

The plugin registers the following WordPress cron events. All cron events are automatically cleared when the plugin is deactivated.

Cron HookIntervalDescription
mautic_woo_process_abandoned_cartsEvery 15 minutesScans for carts that have been inactive past the configured timeout, marks them as abandoned, and syncs them to Mautic. Applies the abandoned cart tag, sends cart data JSON, sets the recovery URL, optionally generates a coupon code, and adds the contact to a Mautic segment if configured.
mautic_woo_cleanup_old_cartsDailyDeletes abandoned cart records older than 90 days from the database. Also cleans up expired recovery coupons when coupon generation is enabled.
mautic_woo_bulk_sync_batchOn demandProcesses batches of users during a bulk sync operation. This event is scheduled dynamically when a bulk sync is started and is unscheduled when the sync completes or is cancelled.

Recovery URL

The plugin registers a custom query parameter for cart recovery. When a visitor loads any page with the mautic_woo_recover query parameter, the plugin intercepts the request on the template_redirect hook, restores the cart contents, optionally applies a recovery coupon, and redirects the visitor to the checkout page.

https://yoursite.com/?mautic_woo_recover=RECOVERY_TOKEN

Next