biz/erp/woocommerce

WOOCOMMERCE

WooCommerce AI integration expert.

production Any HTTP client, Node.js, Python, Cloudflare Workers, PHP
improves: biz/erp

WooCommerce AI Integration

WooCommerce is the world's most widely deployed e-commerce platform, running on WordPress. It exposes a full REST API (v3) for programmatic access to the entire store — products, orders, customers, inventory, coupons, and reports.

Docs: https://woocommerce.github.io/woocommerce-rest-api-docs/

The 2nth Model: One Person + One AI

RoleThe Human DecidesThe AI Enables
Store OwnerStrategy, margins, supplier relationshipsRevenue dashboards, profitability by category, reorder alerts
MerchandiserRange planning, pricing, promotionsBulk product updates, auto-tagging, SEO title/description generation
Content CreatorBrand voice, creative directionProduct descriptions, meta tags, alt text, blog content
Customer ServiceEscalations, refunds, relationship callsOrder lookup, draft responses, return eligibility checks
OperationsException handling, carrier selectionStock alerts, fulfilment routing, fraud flag review
Marketing ManagerCampaign strategy, budgetCoupon performance, customer segmentation, repeat purchase analysis

Authentication

WooCommerce REST API uses Basic Auth over HTTPS with Consumer Key + Consumer Secret.

Generate keys: WooCommerce → Settings → Advanced → REST API → Add key

# Environment variables
WC_URL="https://yourstore.com"
WC_KEY="ck_xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
WC_SECRET="cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# Basic Auth header
Authorization: Basic base64(WC_KEY:WC_SECRET)

Or pass as query params (less secure — avoid in production):

?consumer_key=ck_xxx&consumer_secret=cs_xxx

Base URL:

https://{store}/wp-json/wc/v3/{resource}

Core Resources

Products

# List active products
GET /wp-json/wc/v3/products?status=publish&per_page=100

# Get single product
GET /wp-json/wc/v3/products/{id}

# Create product
POST /wp-json/wc/v3/products
{
  "name": "Product Name",
  "type": "simple",           # simple | variable | grouped | external
  "regular_price": "299.00",
  "description": "...",
  "short_description": "...",
  "categories": [{"id": 12}],
  "images": [{"src": "https://..."}],
  "manage_stock": true,
  "stock_quantity": 50
}

# Update product
PUT /wp-json/wc/v3/products/{id}

# Batch update (up to 100)
POST /wp-json/wc/v3/products/batch
{
  "update": [{"id": 123, "regular_price": "199.00"}],
  "delete": [456]
}

Product Variations

# List variations for a variable product
GET /wp-json/wc/v3/products/{product_id}/variations

# Update variation stock
PUT /wp-json/wc/v3/products/{product_id}/variations/{variation_id}
{ "stock_quantity": 25 }

Orders

# List open orders
GET /wp-json/wc/v3/orders?status=processing&per_page=50

# Statuses: pending | processing | on-hold | completed | cancelled | refunded | failed | trash

# Get single order
GET /wp-json/wc/v3/orders/{id}

# Update order status
PUT /wp-json/wc/v3/orders/{id}
{ "status": "completed" }

# Add order note
POST /wp-json/wc/v3/orders/{id}/notes
{ "note": "Dispatched via FastShip, tracking: FS123456", "customer_note": true }

# Create refund
POST /wp-json/wc/v3/orders/{id}/refunds
{
  "amount": "50.00",
  "reason": "Damaged in transit",
  "line_items": [{"id": 1, "refund_total": 50.00}]
}

Customers

# List customers
GET /wp-json/wc/v3/customers?per_page=100&orderby=registered_date&order=desc

# Search by email
GET /wp-json/wc/v3/customers?email=user@example.com

# Customer object key fields:
{
  "id": 42,
  "email": "user@example.com",
  "first_name": "...",
  "last_name": "...",
  "orders_count": 7,
  "total_spent": "3450.00",
  "date_created": "...",
  "billing": { "address_1": "...", "city": "...", "country": "ZA" }
}

Inventory & Stock

# Low stock report
GET /wp-json/wc/v3/reports/stock?type=lowstock

# Out of stock
GET /wp-json/wc/v3/reports/stock?type=outofstock

# Bulk stock update pattern (batch endpoint)
POST /wp-json/wc/v3/products/batch
{
  "update": [
    {"id": 101, "stock_quantity": 0, "stock_status": "outofstock"},
    {"id": 102, "stock_quantity": 15}
  ]
}

Coupons

# List coupons
GET /wp-json/wc/v3/coupons

# Create coupon
POST /wp-json/wc/v3/coupons
{
  "code": "SAVE20",
  "discount_type": "percent",    # percent | fixed_cart | fixed_product
  "amount": "20",
  "usage_limit": 100,
  "expiry_date": "2026-12-31",
  "minimum_amount": "500.00"
}

Reports

# Sales summary (date range)
GET /wp-json/wc/v3/reports/sales?date_min=2026-01-01&date_max=2026-03-31

# Top sellers
GET /wp-json/wc/v3/reports/top_sellers?period=month

# Orders totals
GET /wp-json/wc/v3/reports/orders/totals

# Revenue by category — requires custom query or plugin; use orders endpoint + line_items

Key MCP Tools

ToolDescription
wc_list_productsList products with filters (status, category, stock)
wc_get_productFull product detail including variations
wc_update_productUpdate price, stock, description, status
wc_batch_update_productsBulk price/stock changes (up to 100)
wc_list_ordersList orders by status, date, customer
wc_get_orderFull order detail with line items, shipping, notes
wc_update_order_statusMove order through status lifecycle
wc_add_order_noteAdd internal or customer-visible note
wc_list_customersCustomer list with spend and order count
wc_get_customer_ordersAll orders for a specific customer
wc_sales_reportRevenue, orders, items for a date range
wc_low_stock_reportProducts below stock threshold
wc_create_couponGenerate promotional codes

AI Workflow Patterns

Daily Operations Brief

1. wc_list_orders(status=processing) → pending fulfilment count
2. wc_low_stock_report() → items needing reorder
3. wc_sales_report(period=yesterday) → revenue vs target
→ Draft morning summary for store owner

Product Description Generation

1. wc_get_product(id) → fetch existing product data
2. AI generates SEO-optimised description using name, category, attributes
3. wc_update_product(id, description, short_description, meta_data[seo])

Customer Win-Back

1. wc_list_customers(last_active_before=90_days_ago)
2. Filter: orders_count >= 2, total_spent >= threshold
3. AI generates personalised re-engagement email per customer
4. wc_create_coupon(code=unique_per_customer) → attach to email

Abandoned Cart Recovery (requires plugin or webhook)

WooCommerce → WooCommerce Abandoned Cart Lite (or Metorik)
Webhook fires → AI drafts recovery email → send via Resend/Mailchimp

Webhooks

WooCommerce fires webhooks on key events. Configure at: WooCommerce → Settings → Advanced → Webhooks

TopicTrigger
order.createdNew order placed
order.updatedStatus change, note added
order.deletedOrder trashed
product.updatedStock change, price update
customer.createdNew account registered

Webhook payload is signed with X-WC-Webhook-Signature (HMAC-SHA256 of the body, keyed with the secret).

// Verify webhook in Cloudflare Worker
const sig = request.headers.get('X-WC-Webhook-Signature');
const body = await request.text();
const expected = btoa(
  String.fromCharCode(...new Uint8Array(
    await crypto.subtle.sign('HMAC', key, new TextEncoder().encode(body))
  ))
);
if (sig !== expected) return new Response('Unauthorized', { status: 401 });

Common Gotchas

See Also