E-commerce

AI Agents for WooCommerce

The same live-lookup pattern as Shopify, against the WooCommerce REST API - with the WordPress hosting realities that decide whether it feels fast.

Assisted setupWooCommerce · bitpull AI agents

Where this stands today

WooCommerce exposes a REST API with consumer key and secret authentication, and it answers the questions a support agent needs: order status, line items, shipping state, product stock. Wiring an agent tool to it is the same shape as the Shopify recipe on this site.

The difference is performance. A Shopify store is a hosted platform with a predictable API. A WooCommerce store is your WordPress install, with your plugins, on your hosting. An order lookup that takes 1.8 seconds on shared hosting is a noticeable silence in a spoken conversation, and no amount of prompt engineering hides it.

That makes caching and a tight timeout the design work here, not the API call itself.

What the agent can do

Order status by number and email

The orders endpoint filters by search term and status. Return the fulfilment state and tracking, and nothing else that is in the order object.

Stock for a product or variation

The products endpoint reports stock status and quantity per variation, which is enough for "do you have it in medium".

Policy answers from crawled content

Shipping, returns and payment pages belong in the agent knowledge, not behind a tool call. No API round-trip, no latency.

Callback on anything sensitive

Refunds, address changes and disputes should end in a callback request delivered by the webhook, not in an API write from a phone call.

How it is wired

  1. Caller asks"Has my order shipped?"
  2. Agent selects toolorder_status(order_id)
  3. Your endpointcache → WooCommerce REST
  4. Spoken answerinside the timeout

Code

Lookup endpoint - WooCommerce REST API with a short cache
const BASE = `${process.env.WC_URL}/wp-json/wc/v3`
const AUTH = 'Basic ' + Buffer
  .from(`${process.env.WC_KEY}:${process.env.WC_SECRET}`)
  .toString('base64')

// A live conversation cannot wait for a cold WordPress query. Sixty seconds of
// cache removes the repeat lookups within one call without going stale.
const cache = new Map()
const TTL = 60_000

export async function orderStatus({ order_id, email }) {
  const key = `order:${order_id}`
  const hit = cache.get(key)
  if (hit && Date.now() - hit.at < TTL) return hit.value

  const ctl = new AbortController()
  const timer = setTimeout(() => ctl.abort(), 3000)   // never outlive the tool timeout

  try {
    const res = await fetch(`${BASE}/orders/${encodeURIComponent(order_id)}`, {
      headers: { Authorization: AUTH },
      signal: ctl.signal
    })
    if (!res.ok) return { found: false, reason: res.status === 404 ? 'not_found' : 'lookup_failed' }

    const order = await res.json()
    if (email && order.billing?.email?.toLowerCase() !== email.toLowerCase()) {
      return { found: false, reason: 'mismatch' }
    }

    const value = {
      found: true,
      status: order.status,                       // processing | completed | …
      placed_at: order.date_created,
      items: order.line_items?.length ?? 0,
      tracking_url: order.meta_data
        ?.find((m) => /tracking[_-]?url/i.test(m.key))?.value ?? null
    }
    cache.set(key, { at: Date.now(), value })
    return value
  } catch {
    return { found: false, reason: 'timeout' }     // the agent says so out loud
  } finally {
    clearTimeout(timer)
  }
}
Basic auth over HTTPS only. Over plain HTTP the key and secret are sent in the clear, and WooCommerce falls back to OAuth 1.0a signing.

Limits worth knowing before you start

  • No WooCommerce plugin for bitpull. This is your endpoint against the WooCommerce REST API, with a tool declaration on the agent side wired up with the team.
  • Performance is yours to own. Object caching, a warm database and a CDN in front of WordPress decide whether the agent sounds responsive.
  • Consumer key and secret carry broad permissions. Issue a read-only pair for this and nothing else.
  • Security plugins and WAF rules routinely block /wp-json. Verify the endpoint answers from your server's IP before assuming the credentials are wrong.
  • Order meta layout differs by plugin - tracking numbers in particular have no standard key. Expect to map yours by hand.

Questions

Is there a WordPress plugin?

No. The website widget is a plain script tag you can paste into a WordPress theme or a code snippet plugin, but there is no bitpull plugin in the WordPress directory.

How do we embed the chat widget in WordPress?

The script tag goes before the closing body tag - via your theme, a header-and-footer snippet plugin, or the site's custom HTML block. The widget generator on this site produces the exact tag.

Can the agent change an order?

Do not let it. Writes triggered by an unverified phone caller are a bad idea in any shop. Collect the request and let the webhook route it to a human.

Ready to run this?

Agents are created and operated on bitpull.ai - this site documents how to connect one. If the outbound webhook is not visible in your dashboard yet, that is the account capability flag, and support can enable it.