WooCommerce Integration
OM_WooCommerce activates automatically when WooCommerce is active. It adds subscriber capture, abandoned cart recovery, revenue attribution, and automation triggers.
Features
- Checkout opt-in — checkbox added before the Place Order button
- Purchase subscribe — auto-subscribes customers who opt in at checkout
- Abandoned cart — snapshots cart after 60 minutes of inactivity; fires
wc_abandoned_cartautomation trigger - Revenue attribution — tracks which campaign clicks led to purchases
- WooCommerce automation triggers —
wc_purchase,wc_abandoned_cart,wc_refund,wc_review_left
Database Tables
om_wc_carts — Abandoned cart snapshots
| Column | Type |
|---|---|
id | BIGINT UNSIGNED PK |
subscriber_id | BIGINT UNSIGNED |
session_key | VARCHAR(64) UNIQUE |
email | VARCHAR(255) |
cart_contents | LONGTEXT (JSON) |
cart_total | DECIMAL(10,2) |
last_activity | DATETIME |
recovery_sent_at | DATETIME |
recovered_at | DATETIME |
om_wc_revenue — Revenue attribution
| Column | Type |
|---|---|
id | BIGINT UNSIGNED PK |
campaign_id | BIGINT UNSIGNED |
subscriber_id | BIGINT UNSIGNED |
order_id | BIGINT UNSIGNED UNIQUE |
order_total | DECIMAL(10,2) |
click_at | DATETIME |
purchased_at | DATETIME |
Merge Tags
{{wc_order_items}} — HTML table of order items
{{wc_order_total}} — Order total formatted
{{wc_store_url}} — WooCommerce shop URL
{{wc_product_name}} — Name of last purchased product
Hooks
php// Filter the opt-in checkbox label
add_filter( 'om_wc_optin_label', function( string $label ): string {
return 'Subscribe to our newsletter for updates and offers';
});
// React when a cart is abandoned
add_action( 'om_wc_cart_abandoned', function( int $subscriber_id, array $cart ): void {
// $cart includes cart_contents, cart_total, session_key
});
// React when a cart is recovered (purchase after abandonment)
add_action( 'om_wc_cart_recovered', function( int $subscriber_id, int $order_id ): void {} );