WooCommerce Connector

WooCommerce Connector

Connect your WooCommerce store to Brevo through Tajo for complete e-commerce data synchronization. Leverage the WooCommerce REST API to sync customers, orders, products, and coupon data for targeted marketing campaigns and automated workflows.

Overview

PropertyValue
PlatformWooCommerce (WordPress)
CategoryE-commerce
Setup ComplexityMedium
Official IntegrationNo
Data SyncedCustomers, Orders, Products, Coupons
Available Skills10

Features

  • Customer sync - Real-time customer data synchronization to Brevo contacts
  • Order tracking - Full order lifecycle event tracking for post-purchase flows
  • Product catalog sync - Sync products and variations for email recommendations
  • Coupon management - Sync coupon codes for promotional campaigns
  • Webhook support - Real-time updates via WooCommerce webhooks
  • Cart abandonment - Track and recover abandoned carts
  • Multi-site support - Connect WordPress multisite WooCommerce installations
  • Custom meta fields - Map WooCommerce custom meta to Brevo attributes

Prerequisites

Before you begin, ensure you have:

  1. A WordPress site with WooCommerce plugin installed and activated
  2. WooCommerce REST API enabled (Settings > Advanced > REST API)
  3. API Consumer Key and Consumer Secret generated
  4. Your site must use HTTPS for API authentication
  5. A Brevo account with API access
  6. A Tajo account with API credentials

Authentication

REST API Keys

WooCommerce uses Consumer Key and Consumer Secret pairs for authentication. Generate these in WooCommerce > Settings > Advanced > REST API.

OAuth 1.0a (HTTPS sites)

Terminal window
curl https://yourstore.com/wp-json/wc/v3/orders \
-u "consumer_key:consumer_secret"

Query String Authentication (HTTPS)

Terminal window
curl "https://yourstore.com/wp-json/wc/v3/orders?consumer_key=ck_xxx&consumer_secret=cs_xxx"

Permission Levels

PermissionAccess
ReadView resources only
WriteCreate and edit resources
Read/WriteFull CRUD access

Configuration

Basic Setup

connectors:
woocommerce:
enabled: true
store_url: "https://yourstore.com"
consumer_key: "ck_your_consumer_key"
consumer_secret: "cs_your_consumer_secret"
api_version: "wc/v3"
verify_ssl: true
# Data sync options
sync:
customers: true
orders: true
products: true
coupons: true
# Brevo list assignment
lists:
all_customers: 50
buyers: 51
abandoned_cart: 52

Customer Field Mapping

Map WooCommerce customer fields to Brevo attributes:

customer_mapping:
email: email
first_name: FIRSTNAME
last_name: LASTNAME
billing.phone: SMS
billing.company: COMPANY
billing.city: CITY
billing.state: STATE
billing.country: COUNTRY
billing.postcode: ZIP
# E-commerce metrics (computed)
orders_count: ORDER_COUNT
total_spent: TOTAL_SPENT
date_created: SIGNUP_DATE
# Meta fields
meta_data.loyalty_points: LOYALTY_POINTS
meta_data.preferred_category: PREF_CATEGORY

Webhook Configuration

Register webhooks in WooCommerce > Settings > Advanced > Webhooks:

webhooks:
- topic: "customer.created"
event: "customer_created"
- topic: "customer.updated"
event: "customer_updated"
- topic: "order.created"
event: "order_placed"
- topic: "order.updated"
event: "order_updated"
- topic: "order.completed"
event: "order_fulfilled"
- topic: "order.refunded"
event: "order_refunded"
- topic: "coupon.created"
event: "coupon_created"
- topic: "product.created"
event: "product_added"
- topic: "product.updated"
event: "product_updated"

API Endpoints

MethodEndpointDescription
GET/wc/v3/customersList customers
POST/wc/v3/customersCreate a customer
GET/wc/v3/customers/{id}Get a customer
PUT/wc/v3/customers/{id}Update a customer
GET/wc/v3/ordersList orders
POST/wc/v3/ordersCreate an order
GET/wc/v3/orders/{id}Get an order
GET/wc/v3/productsList products
GET/wc/v3/products/{id}Get a product
GET/wc/v3/products/{id}/variationsList product variations
GET/wc/v3/couponsList coupons
GET/wc/v3/reports/salesGet sales reports
GET/wc/v3/reports/top_sellersGet top sellers
POST/wc/v3/webhooksCreate a webhook

Code Examples

Initialize WooCommerce Connector

import { TajoClient } from '@tajo/sdk';
const tajo = new TajoClient({
apiKey: process.env.TAJO_API_KEY,
brevoApiKey: process.env.BREVO_API_KEY
});
// Connect WooCommerce store
await tajo.connectors.connect('woocommerce', {
storeUrl: 'https://yourstore.com',
consumerKey: process.env.WC_CONSUMER_KEY,
consumerSecret: process.env.WC_CONSUMER_SECRET
});

Fetch and Sync Customers

// Fetch customers using WooCommerce REST API
const WooCommerce = require('@woocommerce/woocommerce-rest-api').default;
const api = new WooCommerce({
url: 'https://yourstore.com',
consumerKey: process.env.WC_CONSUMER_KEY,
consumerSecret: process.env.WC_CONSUMER_SECRET,
version: 'wc/v3'
});
// List customers with pagination
const response = await api.get('customers', {
per_page: 100,
page: 1,
orderby: 'registered_date',
order: 'desc'
});
const customers = response.data;
// [{ id, email, first_name, last_name, billing, shipping, ... }]
// Pagination info from headers
const totalPages = response.headers['x-wp-totalpages'];
const totalItems = response.headers['x-wp-total'];

Handle Webhook Events

// WooCommerce webhook handler
app.post('/webhooks/woocommerce', async (req, res) => {
const topic = req.headers['x-wc-webhook-topic'];
const signature = req.headers['x-wc-webhook-signature'];
// Verify webhook signature
const expectedSignature = crypto
.createHmac('sha256', WEBHOOK_SECRET)
.update(JSON.stringify(req.body))
.digest('base64');
if (signature !== expectedSignature) {
return res.status(401).send('Invalid signature');
}
// Forward to Tajo
await tajo.connectors.handleWebhook('woocommerce', {
topic,
payload: req.body
});
res.status(200).send('OK');
});

Batch Operations

// Batch create, update, and delete products
const batchResponse = await api.post('products/batch', {
create: [
{ name: 'New Product', type: 'simple', regular_price: '19.99' }
],
update: [
{ id: 123, regular_price: '24.99' }
],
delete: [456]
});

Rate Limits

WooCommerce itself does not enforce API rate limits, but the underlying WordPress server and hosting provider may impose limits:

FactorTypical LimitDetails
Shared hosting50-100 req/minVaries by host
Managed WP hosting200-500 req/minWP Engine, Kinsta, etc.
Self-hostedNo hard limitLimited by server resources
Per page100 records maxDefault is 10
Batch operations100 items/batchCreate, update, or delete

Server Performance

Large WooCommerce stores may experience slow API responses. Use pagination, limit fields with _fields parameter, and schedule bulk syncs during off-peak hours.

Troubleshooting

IssueCauseSolution
401 UnauthorizedInvalid API keysRegenerate Consumer Key/Secret in WooCommerce settings
403 ForbiddenInsufficient permissionsSet API key to Read/Write access
SSL certificate errorsInvalid SSL on siteEnsure valid SSL certificate; set verify_ssl: false for testing only
Webhooks not firingWordPress cron disabledEnable WP-Cron or configure server-level cron
Slow API responsesLarge databaseOptimize WordPress database, use _fields parameter
Missing custom fieldsMeta data not exposedUse meta_data field to access custom meta
Pagination issuesDefault page sizeExplicitly set per_page parameter (max 100)

Best Practices

  1. Use webhooks for real-time sync - Configure WooCommerce webhooks rather than polling the API
  2. Verify webhook signatures - Always validate the X-WC-Webhook-Signature header
  3. Paginate all list requests - Use page and per_page parameters; check X-WP-TotalPages header
  4. Use the _fields parameter - Request only needed fields to reduce response size and improve performance
  5. Batch operations - Use batch endpoints for bulk create/update/delete operations (up to 100 items)
  6. Schedule large syncs - Run initial full syncs during off-peak hours to avoid server strain
  7. Enable HTTPS - WooCommerce API requires HTTPS for OAuth authentication

Security

  • OAuth 1.0a - Secure authentication via Consumer Key/Secret pairs
  • HMAC webhook signatures - SHA-256 signature verification for incoming webhooks
  • HTTPS required - API requires TLS encryption for authentication
  • Permission scoping - API keys can be set to Read, Write, or Read/Write
  • WordPress security - Benefits from WordPress core security updates
  • PCI considerations - Payment data handled by WooCommerce payment gateways, not exposed via API
AI 助手

你好!关于文档有任何问题都可以问我。

免费开始使用Brevo