WooCommerce stores generate rich behavioral data with every transaction, what customers buy, when they abandon a cart, how often they return, which categories they browse. Most stores collect this data passively and never act on it. Connecting WooCommerce to a marketing automation platform like Klaviyo or ActiveCampaign turns that passive data into automated revenue: abandoned cart sequences that recover lost sales, post-purchase flows that drive repeat orders, and product recommendation emails built from real purchase history rather than guesswork.
This guide covers the complete integration path for both platforms: event tracking, list management, purchase-based segmentation, and the automation flows that deliver measurable ROI. Whether you are choosing between Klaviyo and ActiveCampaign or implementing a custom integration on top of an existing plugin setup, the code patterns and architecture decisions here apply directly.

Klaviyo vs ActiveCampaign for WooCommerce: Choosing the Right Platform
Both platforms have official WooCommerce plugins and strong e-commerce feature sets. The right choice depends on your store’s primary use case and technical requirements.
Klaviyo is built specifically for e-commerce. Its data model is optimized for order events, product catalogs, and customer lifetime value metrics. Flows (automated sequences) trigger on WooCommerce events out of the box: placed order, cancelled order, started checkout, viewed product. The segmentation engine is event-based rather than field-based, which means you can create segments like “purchased product X but not product Y in the last 90 days” without any custom configuration. Pricing is list-size based, which can get expensive for large inactive lists.
ActiveCampaign is a broader marketing automation and CRM platform. It handles e-commerce events well but its real strength is multi-channel automation: email sequences, SMS, site messaging, and CRM pipeline management in a unified system. Its deal and pipeline features make it stronger for stores with a sales-assisted model or B2B components. The tag and custom field system is more flexible than Klaviyo for complex segmentation logic. ActiveCampaign’s pricing includes CRM features that Klaviyo charges separately for.
For pure e-commerce stores focused on email: Klaviyo. For stores with a CRM component, B2B customers, or multi-channel needs: ActiveCampaign. This guide covers both because many agencies and developers implement both across different client stores.
Tracking Purchase Events in Klaviyo
Klaviyo’s Track API accepts server-side events that feed into flows and segments. The most important WooCommerce events to track are: Placed Order (after payment), Ordered Product (one event per line item), Started Checkout (cart activity for abandoned cart flows), and Cancelled Order.
The official Klaviyo for WooCommerce plugin handles most of this automatically. The value of custom server-side code is for supplementary events (viewing a specific product category, using a coupon code, reaching a loyalty tier) that the plugin does not track by default.
A few implementation notes. Use woocommerce_order_status_completed rather than woocommerce_payment_complete for the Placed Order event. Payment complete fires immediately after payment authorization, including for orders that may later be cancelled or refunded. Order completed fires only when the store owner marks the order as fulfilled, giving you a more reliable trigger for post-purchase flows.
The customer_properties object uses Klaviyo’s reserved $email identifier to link the event to a profile. Klaviyo creates the profile if it does not exist. Include $first_name and $last_name in the first event to ensure personalization tokens work in your email templates without a separate identify call.
Syncing WooCommerce Customers to ActiveCampaign
ActiveCampaign’s contact model is different from Klaviyo’s. Where Klaviyo builds profiles around event history, ActiveCampaign builds contacts with field values and tags, then triggers automations when conditions on those contacts are met. The integration workflow is: sync contact on purchase, add to a list, apply tags based on purchase behavior, trigger automations from tag assignments.
The contact sync uses ActiveCampaign’s /contact/sync endpoint, which upserts the contact, creating it if no contact with that email exists, updating it if one does. This is the correct pattern for WooCommerce integration: customers may buy multiple times and you do not want duplicate contacts or failed creation calls.
The fieldValues array in the contact payload maps to custom fields you define in your ActiveCampaign account under Contacts → Manage Fields. Common WooCommerce custom fields to create: Total Spent (numeric), Last Order Date (date), Total Orders (numeric), Last Product Category (text). These field values power ActiveCampaign’s segmentation conditions and personalization tokens.
Abandoned Cart Recovery with Klaviyo
Abandoned cart emails are consistently among the highest-ROI email campaigns for e-commerce stores, typically recovering 5–15% of abandoned carts. The prerequisite for Klaviyo’s abandoned cart flow is a “Started Checkout” event that fires before the order is placed. Klaviyo’s flow then waits a configured interval (commonly 1 hour, 4 hours, 24 hours) and sends the recovery email only if no order has been placed in the meantime.
The limitation of this approach is that it only tracks identified users (logged-in customers). Guest checkout users are anonymous until they submit the checkout form. To capture guest cart activity, use the woocommerce_checkout_posted_data filter to fire a Klaviyo identify call when the email field is filled in, before order creation. This extends coverage to guests who reach the checkout form but do not complete their order.
For Klaviyo’s abandoned cart flow to work correctly, the “Started Checkout” event’s properties must include a CheckoutURL pointing to wc_get_checkout_url(). Klaviyo’s pre-built abandoned cart email templates use this URL for the “Return to Cart” button. Without it, the recovery email has no actionable link.
Purchase-Based Segmentation in ActiveCampaign
ActiveCampaign’s automation power comes from its tag system. Tags applied to a contact can trigger automations, filter segments, and personalize email content. For WooCommerce, the most useful tagging strategy maps product categories to “Bought: Category Name” tags, enabling targeted post-purchase sequences per product line.
With this tagging in place, you can build ActiveCampaign automations that trigger when a contact receives a specific tag. A customer tagged “Bought: Electronics” enters an electronics-focused post-purchase sequence. A customer tagged “Bought: Apparel” enters a different sequence with cross-sell recommendations. The same purchase event writes the appropriate tags for both customers simultaneously.
Category-based tags are the most scalable approach because they require no manual maintenance as you add new products, new products automatically inherit their parent category’s tag logic. Product-specific tags (e.g., “Bought: Product Name”) are useful for high-value or time-sensitive products but create tag proliferation for large catalogs. Use both patterns selectively: category tags for broad flows, product tags for VIP or high-margin items.
Post-Purchase Email Sequences
The post-purchase window is the highest-engagement period in the customer lifecycle. Customers have confirmed intent, their inbox open rates are elevated, and they are actively thinking about the product they purchased. A well-designed post-purchase sequence does four things: confirms the order experience, delivers value related to the purchase, introduces complementary products, and invites the customer back for a second purchase.
A high-performing WooCommerce post-purchase sequence for both Klaviyo and ActiveCampaign follows this pattern:
- Day 0, Order confirmation: Transactional email (handled by WooCommerce natively). Do not duplicate this in your automation platform unless you are significantly enhancing it.
- Day 3, Usage tips / onboarding: Deliver value related to the purchased product. For digital products or subscriptions, this is onboarding content. For physical products, it is usage guides or setup instructions.
- Day 7, Check-in / review request: Ask for a product review. Time this after the product has likely arrived and been used. WooCommerce’s native review emails fire on order completion, often before the product arrives. A 7-day delay gives a more realistic review window.
- Day 14, Cross-sell: Introduce complementary products based on purchase history. Klaviyo’s product recommendation blocks can populate this dynamically. ActiveCampaign uses conditional content blocks based on the contact’s “Bought: Category” tags.
- Day 30, Replenishment or loyalty: For consumable products, a replenishment reminder. For non-consumables, a loyalty or referral offer.
Not every store needs all five emails. A single category purchase may only warrant steps 1, 3, and 5. The sequence length should match the product’s natural usage cycle: a consumable product (supplements, coffee, skincare) deserves a full replenishment sequence; a durable goods purchase may stop at step 4.
Product Recommendation Emails
Product recommendation emails outperform generic promotional emails because they are relevant by definition, they are based on what the recipient has already bought or browsed. Both Klaviyo and ActiveCampaign support dynamic product recommendation blocks, but the underlying logic differs.
Klaviyo product recommendations use a machine learning engine that analyzes purchase history across your entire customer base to surface “customers who bought X also bought Y” recommendations. These update automatically as new orders come in. The product feed is synced from WooCommerce’s product catalog via the integration. Klaviyo’s recommendation blocks appear in the email builder as dynamic content that populates at send time.
ActiveCampaign product recommendations require more manual configuration. You set up product blocks in email templates and populate them using conditional content rules based on tags (e.g., show this product block if the contact has tag “Bought: Electronics”). This is more granular but less dynamic than Klaviyo’s ML approach. For catalogs with clear category structure and predictable cross-sells, ActiveCampaign’s approach is easier to control and audit.
For most WooCommerce stores, the practical recommendation is: use Klaviyo’s ML engine if you have enough order volume (200+ orders/month) for it to produce meaningful recommendations. Below that volume, ActiveCampaign’s rule-based approach produces more reliable results because there is not enough purchase history for collaborative filtering to work well.
Using the Official Plugins vs Custom Integration
Both Klaviyo and ActiveCampaign publish official WooCommerce plugins. For most stores, the official plugins handle the core integration reliably: contact sync, order event tracking, abandoned cart, product feed sync. The custom PHP approach in this guide is valuable for two scenarios: supplementary events the official plugin does not track, and stores that need fine-grained control over what data is shared (GDPR compliance, sensitive customer segments, B2B data restrictions).
If you are using the official Klaviyo plugin, avoid duplicating its events with custom code. Sending duplicate “Placed Order” events from both the plugin and your custom hook creates duplicate flow triggers and inflates your event history. Review the plugin’s hooks and settings first to understand what it tracks, then add only what is missing.
One area where custom code consistently adds value even alongside official plugins: syncing custom order meta. If your store records custom data at checkout (delivery preferences, special instructions, custom product configurations), the official plugins do not know about these fields. Custom event properties or ActiveCampaign custom field syncs are needed to get this data into your automation platform.
Performance and Rate Limiting
Marketing automation API calls in synchronous WordPress hooks add latency to the request cycle. A woocommerce_order_status_completed hook that fires a wp_remote_post call to Klaviyo adds the Klaviyo API’s response time to the order completion processing time. On high-traffic stores, this compounds across concurrent order completions.
The solution is to offload marketing automation API calls to a background queue. Use WooCommerce’s Action Scheduler (included in WooCommerce core) to enqueue the API call rather than firing it synchronously:
// Schedule the API call instead of making it inline.
add_action( 'woocommerce_order_status_completed', function( int $order_id ): void {
as_enqueue_async_action(
'my_plugin_sync_order_to_klaviyo',
array( 'order_id' => $order_id ),
'my-plugin'
);
} );
// Process the queued action in the background.
add_action( 'my_plugin_sync_order_to_klaviyo', function( int $order_id ): void {
// Your Klaviyo API call here, runs in background via Action Scheduler.
} );
Action Scheduler processes queued actions on the next WP-Cron cycle, decoupling the API latency from the user-facing order flow. This pattern also provides built-in retry logic: if the Klaviyo API is temporarily unavailable, Action Scheduler retries the failed action automatically.
GDPR and Data Consent Considerations
Sending customer data to marketing automation platforms without explicit consent can violate GDPR for EU customers and similar regulations elsewhere. Before implementing any of the integrations in this guide, ensure your WooCommerce checkout has an explicit marketing consent checkbox (separate from the privacy policy acceptance) and that your integration code checks consent status before sending data.
WooCommerce stores the marketing opt-in status in order meta if you are using a compliant consent plugin (WooCommerce’s native newsletter opt-in, or a third-party GDPR plugin). Before firing any Klaviyo or ActiveCampaign API call, check this meta value:
// Check marketing consent before syncing to platform.
$consent = get_post_meta( $order_id, '_marketing_opt_in', true );
if ( 'yes' !== $consent ) {
return; // Do not send data without explicit consent.
}
Both Klaviyo and ActiveCampaign also have unsubscribe and suppression list features that prevent sending to contacts who have opted out. Configure these suppressions to sync with WooCommerce’s “Do Not Email” list if you maintain one, to ensure compliance holds across both systems.
Testing Your Integration
Before going live, verify the integration end-to-end with test orders. Place a test order using a real email address, then confirm the event appears in Klaviyo’s Activity Feed or ActiveCampaign’s contact timeline. Verify that abandoned cart events fire correctly by adding items to the cart as a logged-in user, waiting without checking out, and confirming the “Started Checkout” event appears in the platform.
Common integration issues to check: events not firing because the hook priority runs before WooCommerce saves the order (use priority 20 or later for order hooks), duplicate events from both the official plugin and custom code, and missing contact data because the API response was not checked for errors before using the contact ID.
Both platforms have event activity logs accessible in their dashboards. Use these logs during testing, they show the exact payload received, which makes debugging malformed events far faster than reviewing PHP error logs. For a broader look at WooCommerce development patterns, including the custom data structures that can drive segmentation, the WooCommerce Store API developer guide covers the data model in depth.
Win-Back Campaigns for Lapsed Customers
The most overlooked marketing automation opportunity is the win-back campaign. A customer who purchased once and has not returned in 90–120 days is a lapsed customer. Both Klaviyo and ActiveCampaign can identify these customers automatically and trigger a targeted re-engagement sequence.
In Klaviyo, a win-back flow triggers from a metric condition: “Customer has placed an order at least once but has not placed an order in the last X days.” This is configured in the flow trigger settings using Klaviyo’s predictive analytics, specifically the predicted days until next order metric. Customers whose predicted next order date has passed without a purchase enter the win-back flow automatically.
In ActiveCampaign, win-back automations use date-based conditions: enter the automation when the contact’s Last Order Date custom field is more than 90 days ago. Pair this with a goal condition that exits the automation early if the contact places a new order during the sequence.
A three-email win-back sequence performs well for most stores: email 1 (day 0) is a soft check-in (“We miss you”); email 2 (day 7) is a relevant product recommendation based on the contact’s purchase history; email 3 (day 14) is a time-limited discount offer with explicit expiry. The discount only in the third email avoids training customers to wait for win-back coupons on every purchase cycle.
The win-back campaign works alongside the post-purchase sequence but targets a different lifecycle stage. Stores that implement both typically see 8–12% of lapsed customers reactivated within the first 30 days. For a broader CRM strategy that goes beyond email, the WooCommerce HubSpot CRM integration guide covers combining email automation with CRM pipeline management and the Salesforce integration guide covers enterprise-level customer lifecycle tracking.
Measuring Automation ROI
Both Klaviyo and ActiveCampaign provide revenue attribution reports that credit automation flows with the orders they influenced. Klaviyo’s attribution window defaults to 5 days for email click and 1 day for email open, an order placed within that window after an email interaction is credited to the flow. ActiveCampaign’s revenue reporting requires connecting to an e-commerce integration and configuring goal events.
Track three metrics per flow: conversion rate (recipients who completed the target action), revenue per recipient (total attributed revenue divided by recipients entered), and unsubscribe rate. The conversion rate tells you if the flow is compelling; revenue per recipient normalizes performance across flows with different email counts; unsubscribe rate catches flows that are too aggressive or poorly timed.
Compare flow revenue against the opportunity cost of not having the flow. An abandoned cart flow recovering 8% of abandoned carts at an average order value of $85 generates $6.80 per entered contact. If 500 contacts enter the flow monthly, that is $3,400 in monthly attributed revenue from automation alone. This calculation justifies the integration cost in concrete terms for stakeholders who question the ROI of marketing automation investment.
Wrapping Up
Connecting WooCommerce to Klaviyo or ActiveCampaign is one of the highest-leverage technical improvements a store can make. The revenue impact of automated abandoned cart recovery and post-purchase sequences typically exceeds the development cost within weeks of launch.
The code patterns in this guide, server-side event tracking, contact sync, tag-based segmentation, Action Scheduler offloading, form a solid foundation for any WooCommerce marketing automation implementation. Start with the abandoned cart and post-purchase flows before building more complex automations; these two flows deliver the majority of the revenue lift and establish that your event tracking is working correctly before you layer on more sophisticated logic.
One final architectural consideration: treat your marketing automation platform as a downstream consumer of WooCommerce data, not a source of truth. All customer records, order history, and product catalog data should live in WooCommerce first. The marketing platform receives a copy via your sync hooks, but decisions about order status, inventory, and pricing are always made in WooCommerce. This separation of concerns keeps the integration reversible, if you switch from Klaviyo to another platform in two years, you change the sync hooks, not your data model. A clean integration boundary also makes debugging straightforward: if a customer’s automation sequence is wrong, check the WooCommerce event payload first, then the platform’s contact record. The issue is almost always at the boundary.
For a broader picture of WooCommerce’s REST and event architecture that powers these integrations, the WooCommerce Store API developer guide covers the full data layer these event payloads are built on top of.

