Connect WooCommerce

Let your AI voice agent look up WooCommerce orders during a call. Create read-only WooCommerce REST API keys, store them in the credential vault and add one custom HTTP function. No WordPress plugin needed.

3 min read

Your voice agent can look up WooCommerce orders during a call using the WooCommerce REST API. You create read-only API keys in WooCommerce, keep them in the Edesy credential vault, and add one custom HTTP function. It takes about 10 minutes, and no WordPress plugin is needed.

A one-click WooCommerce connector is coming. Until then, this guide is the way to connect WooCommerce.

Before you start#

  • Your store runs on HTTPS (WooCommerce only accepts API keys over HTTPS).
  • You're a WooCommerce administrator (needed to create API keys).
  • WordPress permalinks are not set to "Plain" (Settings → Permalinks). The REST API needs pretty permalinks.

Step 1: Create read-only API keys#

  1. In WordPress, go to WooCommerce → Settings → Advanced → REST API → Add key.
  2. Description: Edesy voice agent. Permissions: Read.
  3. Click Generate API key and copy the Consumer key (ck_…) and Consumer secret (cs_…). The secret is shown only once.

Read access is enough to look up orders, and it means the agent can't change anything in your store.

Step 2: Store the keys in the credential vault#

In your agent's Tools tab, open Credentials and add a credential named woo with two fields, consumer_key and consumer_secret. You'll reference them as {{vault.woo.consumer_key}} and {{vault.woo.consumer_secret}}. See Credential Vault.

Step 3: Add the order lookup function#

Open your agent → Tools → Custom Functions and create:

Field Value
Function Name get_order_status
Description Look up a WooCommerce order when the customer asks where their order is. Needs the order number.
Method GET
URL https://yourstore.com/wp-json/wc/v3/orders/{{order_id}}?consumer_key={{vault.woo.consumer_key}}&consumer_secret={{vault.woo.consumer_secret}}
Parameters order_id (string, required): "The order number the customer gives"
Response Mapping {"status": "status", "date": "date_created", "total": "total", "item": "line_items.0.name", "city": "shipping.city"}

Replace yourstore.com with your store's domain. Click Test with a real order number. You should get the order's status back.

WooCommerce order statuses the agent will see: pending (awaiting payment), processing (paid, being prepared), on-hold, completed (fulfilled), cancelled, refunded, failed. Tell the agent what each means for your store in its prompt, for example "processing means we're packing it; it ships within two days".

Find orders by phone number (optional)#

To find a caller's recent orders without an order number, add a second function:

Field Value
Function Name find_orders_by_phone
URL https://yourstore.com/wp-json/wc/v3/orders?search={{call.phone_number}}&per_page=3&consumer_key={{vault.woo.consumer_key}}&consumer_secret={{vault.woo.consumer_secret}}
Response Mapping {"latest_status": "0.status", "latest_date": "0.date_created", "latest_item": "0.line_items.0.name"}

{{call.phone_number}} is the caller's own number, filled in automatically, so this only returns orders placed with the number that's calling. WooCommerce matches it against the order's billing details, so the phone must be saved on orders in the same format your customers call from. Test it with a real order first.

Step 4: Tell the agent how to use it#

When a customer asks about an order, ask for the order number and call get_order_status.
If they don't have it, call find_orders_by_phone.
Read the status in one short sentence, in the customer's language.
For cancellations, address changes, refunds or returns, transfer the call to the team.

Step 5: Test and go live#

Call the agent from the Test Center, ask about a real order, and check the reply. Then assign a phone number.

Troubleshooting#

You see Likely cause Fix
401 / woocommerce_rest_cannot_view Wrong keys, or keys without Read permission Generate a new Read key and update the vault
404 / rest_no_route Permalinks set to "Plain", or a wrong domain Change permalinks, check the URL in a browser
woocommerce_rest_shop_order_invalid_id No order with that number The agent should ask the caller to check the number
Works in a browser but not in the function A security plugin or firewall blocks API requests Allow /wp-json/wc/v3/ in the plugin or firewall

Calls when an order changes#

To call customers when an order is placed or shipped, and get the result back, see Order events and outcomes. For cash-on-delivery confirmation calls, use Edesy Order Calls.

Need help?#

Tell us about your store and we'll help you set it up.

Was this page helpful?