WooCommerce Integration Guide
This comprehensive guide walks you through integrating Tajo with your WooCommerce store to unlock powerful customer engagement, loyalty programs, and marketing automation capabilities.
Overview
The Tajo-WooCommerce integration enables you to:
- Sync customer data automatically from your WooCommerce store
- Track orders and products for personalized marketing
- Run loyalty programs with points, tiers, and rewards
- Automate marketing campaigns via Brevo (email, SMS, WhatsApp)
- Segment customers by purchase behavior and engagement
- Recover abandoned carts with automated sequences
Prerequisites
Before starting the integration, ensure you have:
- WordPress site with WooCommerce installed (version 7.0+)
- Tajo account with an active subscription
- Brevo account (optional, for marketing automation)
- Admin access to your WordPress site
- PHP 7.4+ and WordPress 6.0+
Step 1: Install the Tajo Plugin
From WordPress Plugin Directory
- Go to your WordPress admin dashboard
- Navigate to Plugins → Add New
- Search for “Tajo for WooCommerce”
- Click Install Now then Activate
- Go to WooCommerce → Tajo to configure
Manual Installation
If you prefer manual setup:
# Download the plugincd wp-content/pluginswget https://downloads.tajo.io/woocommerce/tajo-woocommerce-latest.zip
# Unzip and installunzip tajo-woocommerce-latest.zipThen activate from WordPress admin:
- Go to Plugins → Installed Plugins
- Find “Tajo for WooCommerce”
- Click Activate
Configuration
Navigate to WooCommerce → Tajo → Settings and enter your credentials:
// These settings are configured via the admin panel// or can be added to wp-config.php for advanced setups
define('TAJO_API_KEY', 'your_tajo_api_key');define('TAJO_API_SECRET', 'your_tajo_api_secret');define('BREVO_API_KEY', 'your_brevo_api_key'); // OptionalStep 2: Configure Data Sync
Customer Sync Settings
In your Tajo dashboard, configure which customer data to sync:
{ "sync_settings": { "customers": { "enabled": true, "sync_frequency": "real-time", "fields": [ "email", "first_name", "last_name", "billing_phone", "accepts_marketing", "total_spent", "order_count", "date_created", "billing_address", "shipping_address" ] }, "orders": { "enabled": true, "sync_frequency": "real-time", "include_line_items": true, "include_shipping": true }, "products": { "enabled": true, "sync_frequency": "hourly", "include_variations": true, "include_images": true } }}WooCommerce Hooks
Tajo automatically hooks into these WooCommerce actions:
| Hook | Purpose |
|---|---|
woocommerce_created_customer | Sync new customers to Tajo & Brevo |
woocommerce_update_customer | Keep customer profiles current |
woocommerce_new_order | Track purchases, award loyalty points |
woocommerce_order_status_completed | Trigger post-purchase campaigns |
woocommerce_order_status_processing | Send order confirmation |
woocommerce_cart_updated | Track cart for abandonment |
woocommerce_update_product | Keep product catalog synced |
Initial Data Import
For existing stores, import historical data:
<?php// Import existing customers to Tajofunction tajo_import_existing_customers() { $customers = get_users([ 'role' => 'customer', 'number' => -1 ]);
foreach ($customers as $customer) { $customer_data = new WC_Customer($customer->ID);
tajo_sync_customer([ 'email' => $customer_data->get_email(), 'firstName' => $customer_data->get_first_name(), 'lastName' => $customer_data->get_last_name(), 'phone' => $customer_data->get_billing_phone(), 'totalSpent' => $customer_data->get_total_spent(), 'ordersCount' => $customer_data->get_order_count(), 'source' => 'woocommerce', 'externalId' => $customer->ID ]); }}
// Run importtajo_import_existing_customers();Step 3: Set Up Loyalty Program
Configure Points System
Define how customers earn points in WooCommerce → Tajo → Loyalty:
<?php// Points configuration$points_config = [ // Points per dollar spent 'purchase_points' => [ 'enabled' => true, 'rate' => 1, // 1 point per $1 'rounding_mode' => 'floor' ],
// Bonus actions 'bonus_points' => [ 'account_creation' => 100, 'first_purchase' => 200, 'review_submitted' => 50, 'referral_made' => 500, 'birthday_bonus' => 100, 'newsletter_signup' => 25 ],
// Tier multipliers 'tier_multipliers' => [ 'Bronze' => 1.0, 'Silver' => 1.25, 'Gold' => 1.5, 'Platinum' => 2.0 ]];Loyalty Widget Shortcodes
Display loyalty information on your site:
// Customer points balance[tajo_points_balance]
// Points history[tajo_points_history limit="10"]
// Current tier status[tajo_loyalty_tier]
// Available rewards[tajo_rewards_catalog]
// Referral link[tajo_referral_link]Define Loyalty Tiers
<?php$loyalty_tiers = [ [ 'name' => 'Bronze', 'min_points' => 0, 'benefits' => [ '1 point per $1 spent', 'Birthday bonus points', 'Member-only promotions' ] ], [ 'name' => 'Silver', 'min_points' => 1000, 'benefits' => [ '1.25x points multiplier', 'Free shipping on orders $50+', 'Early access to sales' ] ], [ 'name' => 'Gold', 'min_points' => 5000, 'benefits' => [ '1.5x points multiplier', 'Free shipping on all orders', 'Exclusive product access', 'Priority customer support' ] ], [ 'name' => 'Platinum', 'min_points' => 15000, 'benefits' => [ '2x points multiplier', 'Free express shipping', 'VIP experiences', 'Personal shopping assistant', 'Annual gift' ] ]];Create Rewards Catalog
<?php$rewards = [ [ 'id' => 'discount_5', 'name' => '$5 Off', 'points_cost' => 500, 'type' => 'fixed_cart', 'value' => 5, 'min_purchase' => 25 ], [ 'id' => 'discount_10', 'name' => '$10 Off', 'points_cost' => 900, 'type' => 'fixed_cart', 'value' => 10, 'min_purchase' => 50 ], [ 'id' => 'percent_10', 'name' => '10% Off', 'points_cost' => 750, 'type' => 'percent', 'value' => 10, 'max_discount' => 50 ], [ 'id' => 'free_shipping', 'name' => 'Free Shipping', 'points_cost' => 300, 'type' => 'free_shipping' ]];Step 4: Abandoned Cart Recovery
Configure Cart Tracking
<?php// Track cart updatesadd_action('woocommerce_cart_updated', 'tajo_track_cart');
function tajo_track_cart() { if (!is_user_logged_in() && !WC()->session->get('tajo_guest_email')) { return; // Need email for tracking }
$cart = WC()->cart; if ($cart->is_empty()) { return; }
$customer_email = is_user_logged_in() ? wp_get_current_user()->user_email : WC()->session->get('tajo_guest_email');
$cart_items = []; foreach ($cart->get_cart() as $item) { $product = $item['data']; $cart_items[] = [ 'productId' => $item['product_id'], 'variantId' => $item['variation_id'] ?: null, 'title' => $product->get_name(), 'quantity' => $item['quantity'], 'price' => $product->get_price(), 'image' => wp_get_attachment_url($product->get_image_id()) ]; }
tajo_api_call('carts/track', [ 'email' => $customer_email, 'cartToken' => WC()->session->get_customer_id(), 'items' => $cart_items, 'totalPrice' => $cart->get_total('edit'), 'currency' => get_woocommerce_currency(), 'checkoutUrl' => wc_get_checkout_url() ]);}Capture Guest Email
<?php// Capture email at checkout for guest recoveryadd_action('woocommerce_after_checkout_billing_form', 'tajo_capture_guest_email_js');
function tajo_capture_guest_email_js() { ?> <script> jQuery(function($) { $('#billing_email').on('blur', function() { var email = $(this).val(); if (email && email.includes('@')) { $.post('<?php echo admin_url('admin-ajax.php'); ?>', { action: 'tajo_capture_email', email: email, nonce: '<?php echo wp_create_nonce('tajo_email_capture'); ?>' }); } }); }); </script> <?php}
add_action('wp_ajax_nopriv_tajo_capture_email', 'tajo_capture_email_handler');function tajo_capture_email_handler() { check_ajax_referer('tajo_email_capture', 'nonce'); WC()->session->set('tajo_guest_email', sanitize_email($_POST['email'])); wp_die();}Set Up Recovery Sequence
{ "abandoned_cart_sequence": { "trigger": { "event": "cart_abandoned", "delay": "1 hour" }, "messages": [ { "delay": "1 hour", "channel": "email", "template": "cart_reminder_1", "subject": "You left something behind!" }, { "delay": "24 hours", "channel": "email", "template": "cart_reminder_2", "subject": "Your cart is waiting - 10% off inside" }, { "delay": "72 hours", "channel": "sms", "template": "cart_sms_final", "message": "Last chance! Your cart expires soon. Complete your order: {{checkout_url}}" } ], "exit_conditions": [ "order_completed", "cart_emptied", "unsubscribed" ] }}Step 5: Marketing Automation with Brevo
Customer Segments
Create segments based on WooCommerce data:
<?php$woo_segments = [ // Purchase behavior [ 'name' => 'First-Time Buyers', 'conditions' => ['order_count' => 1] ], [ 'name' => 'Repeat Customers', 'conditions' => ['order_count' => ['$gte' => 2]] ], [ 'name' => 'VIP Customers', 'conditions' => ['total_spent' => ['$gte' => 500]] ], [ 'name' => 'At-Risk Customers', 'conditions' => [ 'last_order_date' => ['$lt' => '-90 days'], 'order_count' => ['$gte' => 2] ] ],
// Product interest [ 'name' => 'Category: Electronics', 'conditions' => ['purchased_categories' => ['$contains' => 'Electronics']] ],
// Engagement [ 'name' => 'Abandoned Cart', 'conditions' => ['has_abandoned_cart' => true] ]];Automated Campaign Triggers
<?php// Order completed - award points and trigger campaignsadd_action('woocommerce_order_status_completed', 'tajo_order_completed', 10, 1);
function tajo_order_completed($order_id) { $order = wc_get_order($order_id); $customer_email = $order->get_billing_email();
// Get or create customer in Tajo $customer = tajo_get_customer($customer_email);
// Calculate and award points $points_earned = tajo_calculate_points($order, $customer); tajo_award_points($customer['id'], $points_earned, [ 'reason' => 'purchase', 'orderId' => $order_id ]);
// Send to Brevo for campaigns brevo_track_event($customer_email, 'order_completed', [ 'order_id' => $order_id, 'order_total' => $order->get_total(), 'points_earned' => $points_earned, 'loyalty_tier' => $customer['loyaltyTier'], 'products' => array_map(function($item) { return $item->get_name(); }, $order->get_items()) ]);}
// Post-purchase review request$review_request_campaign = [ 'trigger' => 'order_completed', 'delay' => '14 days', // Give time for delivery 'template' => 'review_request', 'conditions' => [ 'customer_opted_in' => true ]];
// Win-back campaign$win_back_campaign = [ 'trigger' => 'customer_inactive', 'conditions' => [ 'last_order_date' => '-90 days', 'order_count' => ['$gte' => 1] ], 'sequence' => [ ['delay' => '0', 'template' => 'we_miss_you', 'offer' => '15% off'], ['delay' => '7 days', 'template' => 'win_back_2', 'offer' => '20% off'], ['delay' => '14 days', 'template' => 'final_offer', 'offer' => '25% off'] ]];Step 6: Product Recommendations
Configure Recommendation Engine
<?php$recommendation_config = [ 'algorithms' => [ [ 'name' => 'frequently_bought_together', 'weight' => 0.3 ], [ 'name' => 'similar_products', 'weight' => 0.25 ], [ 'name' => 'customer_also_viewed', 'weight' => 0.2 ], [ 'name' => 'trending_in_category', 'weight' => 0.15 ], [ 'name' => 'personalized_for_you', 'weight' => 0.1 ] ], 'filters' => [ 'exclude_purchased' => true, 'exclude_out_of_stock' => true, 'min_rating' => 3.5 ]];Display Recommendations
// Shortcode for product recommendations[tajo_recommendations limit="4" algorithm="frequently_bought_together"]
// Or use in templates<?php$recommendations = tajo_get_recommendations([ 'customer_id' => get_current_user_id(), 'limit' => 4, 'context' => 'product_page', 'current_product' => get_the_ID()]);
foreach ($recommendations as $product_id) { $product = wc_get_product($product_id); // Display product}?>Step 7: Analytics & Reporting
Key Metrics Dashboard
Access analytics at WooCommerce → Tajo → Analytics or via API:
<?php$dashboard_metrics = [ // Customer metrics 'customers' => [ 'total' => tajo_analytics_count('customers'), 'new_this_month' => tajo_analytics_count('customers', [ 'created_at' => ['$gte' => 'this_month'] ]), 'returning_rate' => tajo_analytics_returning_customer_rate() ],
// Revenue metrics 'revenue' => [ 'total' => tajo_analytics_sum('orders.total'), 'average_order_value' => tajo_analytics_avg('orders.total'), 'revenue_per_customer' => tajo_analytics_revenue_per_customer() ],
// Loyalty metrics 'loyalty' => [ 'active_members' => tajo_analytics_count('loyalty_members', [ 'status' => 'active' ]), 'points_issued' => tajo_analytics_sum('points.awarded'), 'points_redeemed' => tajo_analytics_sum('points.redeemed'), 'redemption_rate' => tajo_analytics_points_redemption_rate() ],
// Campaign metrics 'campaigns' => [ 'emails_sent' => brevo_analytics_emails_sent('this_month'), 'open_rate' => brevo_analytics_open_rate('this_month'), 'click_rate' => brevo_analytics_click_rate('this_month'), 'revenue_attributed' => tajo_analytics_campaign_revenue('this_month') ]];Troubleshooting
Common Issues
Plugin Conflicts
<?php// Check for conflicting pluginsfunction tajo_check_conflicts() { $conflicts = [];
$problematic_plugins = [ 'some-caching-plugin/plugin.php', 'aggressive-minifier/plugin.php' ];
foreach ($problematic_plugins as $plugin) { if (is_plugin_active($plugin)) { $conflicts[] = $plugin; } }
return $conflicts;}Webhook Verification
<?php// Verify webhook signature from Tajofunction tajo_verify_webhook($payload, $signature) { $expected = hash_hmac( 'sha256', $payload, get_option('tajo_webhook_secret') );
return hash_equals($expected, $signature);}Sync Issues
<?php// Debug sync issuesfunction tajo_debug_sync($customer_id) { $customer = new WC_Customer($customer_id);
error_log('Tajo Sync Debug for Customer ' . $customer_id); error_log('Email: ' . $customer->get_email()); error_log('Total Spent: ' . $customer->get_total_spent()); error_log('Order Count: ' . $customer->get_order_count());
// Test API connection $response = tajo_api_call('ping'); error_log('API Response: ' . print_r($response, true));}Rate Limiting
<?php// Implement rate limiting for API callsfunction tajo_rate_limited_call($endpoint, $data, $retries = 3) { for ($i = 0; $i < $retries; $i++) { $response = tajo_api_call($endpoint, $data);
if (!is_wp_error($response)) { return $response; }
if ($response->get_error_code() === 'rate_limited') { $delay = pow(2, $i) * 1000000; // Exponential backoff in microseconds usleep($delay); continue; }
break; }
return $response;}Next Steps
- Configure Brevo Integration for email/SMS campaigns
- Set Up Webhooks for real-time events
- Create Customer Segments for targeted marketing
- Build Email Templates for automated campaigns
Support
- Integration Support: [email protected]
- WooCommerce Documentation: woocommerce.com/documentation
- API Reference: docs.tajo.io/api
- Community Forum: community.tajo.io