WooCommerce Integration
The WooCommerce integration lets agents look up orders, manage customers, handle products, create coupons, and issue refunds — directly from a conversation. Use it to build order support bots, store management tools, or sales assistants on top of your WordPress/WooCommerce store.
Authentication
WooCommerce uses Consumer Key and Consumer Secret (REST API v3).
To generate keys:
- Go to your WordPress Admin → WooCommerce → Settings → Advanced → REST API
- Click Add Key
- Set Permissions to
Read/Write - Click Generate API Key
- Copy the Consumer Key and Consumer Secret
| Field | Description |
|---|---|
| Store URL | Your store's full base URL (e.g. https://mystore.com) |
| Consumer Key | Starts with ck_ |
| Consumer Secret | Starts with cs_ |
Installing
- Go to your project → Integrations → Browse
- Find WooCommerce and click Install
- Enter your Store URL, Consumer Key, and Consumer Secret
- Select the actions you want to enable
- Click Install
Actions
get_order — Get Order
Retrieves a single order by ID.
Tool reference: {{tool:woocommerce_get_order}}
| Parameter | Required | Description |
|---|---|---|
order_id | Yes | WooCommerce order ID |
Returns: Full order including line items, customer, status, billing/shipping addresses, totals, and payment method
list_orders — List Orders
Lists orders with optional status filter.
Tool reference: {{tool:woocommerce_list_orders}}
| Parameter | Required | Description |
|---|---|---|
status | No | pending, processing, on-hold, completed, cancelled, refunded, failed, or any |
per_page | No | Results per page (default 10, max 100) |
Returns: Array of orders with order_id, status, total, customer_id, date_created
update_order — Update Order
Updates an order's status or adds a customer note.
Tool reference: {{tool:woocommerce_update_order}}
| Parameter | Required | Description |
|---|---|---|
order_id | Yes | Order to update |
status | No | New order status |
customer_note | No | Note visible to the customer |
create_order — Create Order
Creates a new order.
Tool reference: {{tool:woocommerce_create_order}}
| Parameter | Required | Description |
|---|---|---|
status | Yes | Initial status (e.g. pending, processing) |
customer_id | No | Existing customer ID (0 for guest) |
first_name | No | Billing first name |
last_name | No | Billing last name |
email | No | Billing email address |
line_items | Yes | JSON array of {product_id, quantity} objects |
get_customer — Get Customer
Retrieves a customer by ID.
Tool reference: {{tool:woocommerce_get_customer}}
| Parameter | Required | Description |
|---|---|---|
customer_id | Yes | WooCommerce customer ID |
Returns: Customer name, email, registered date, order count, and total spend
create_customer — Create Customer
Creates a new customer account.
Tool reference: {{tool:woocommerce_create_customer}}
| Parameter | Required | Description |
|---|---|---|
email | Yes | Customer email (must be unique) |
first_name | No | First name |
last_name | No | Last name |
username | No | WordPress username (auto-generated if omitted) |
password | No | Account password (auto-generated if omitted) |
Returns: customer_id, email, date_created
update_customer — Update Customer
Updates a customer's profile.
Tool reference: {{tool:woocommerce_update_customer}}
| Parameter | Required | Description |
|---|---|---|
customer_id | Yes | Customer to update |
first_name | No | New first name |
last_name | No | New last name |
email | No | New email address |
get_product — Get Product
Retrieves a product by ID.
Tool reference: {{tool:woocommerce_get_product}}
| Parameter | Required | Description |
|---|---|---|
product_id | Yes | WooCommerce product ID |
Returns: Product name, status, price, stock status, description, and variations
list_products — List Products
Lists products with optional filters.
Tool reference: {{tool:woocommerce_list_products}}
| Parameter | Required | Description |
|---|---|---|
status | No | publish, draft, trash |
search | No | Search by product name |
per_page | No | Results per page (default 10) |
create_product — Create Product
Creates a new product.
Tool reference: {{tool:woocommerce_create_product}}
| Parameter | Required | Description |
|---|---|---|
name | Yes | Product name |
type | No | simple, variable, grouped (default: simple) |
status | No | publish or draft (default: draft) |
price | No | Regular price |
description | No | Full product description |
short_description | No | Short excerpt shown on listing pages |
sku | No | Stock Keeping Unit |
stock_quantity | No | Initial stock count |
update_product — Update Product
Updates a product's details.
Tool reference: {{tool:woocommerce_update_product}}
| Parameter | Required | Description |
|---|---|---|
product_id | Yes | Product to update |
name | No | New name |
price | No | New regular price |
status | No | New status |
stock_quantity | No | Updated stock quantity |
create_coupon — Create Coupon
Creates a discount coupon.
Tool reference: {{tool:woocommerce_create_coupon}}
| Parameter | Required | Description |
|---|---|---|
code | Yes | Coupon code (case-insensitive) |
discount_type | Yes | percent or fixed_cart |
amount | Yes | Discount value (percent or fixed amount) |
individual_use | No | true to prevent combining with other coupons |
usage_limit | No | Maximum number of times this coupon can be used |
expires | No | Expiry date (YYYY-MM-DD) |
Returns: coupon_id, code, discount_type, amount
create_refund — Create Refund
Issues a refund for an order.
Tool reference: {{tool:woocommerce_create_refund}}
| Parameter | Required | Description |
|---|---|---|
order_id | Yes | Order to refund |
amount | Yes | Refund amount |
reason | No | Reason for the refund |
process_payment_refund | No | true to automatically reverse the payment (default: true) |
Using WooCommerce in an agent
Order support agent
You are a customer support agent for an online store.
When a customer asks about an order:
1. Ask for their order number.
2. Use {{tool:woocommerce_get_order}} to retrieve it.
3. Share the order status and items in plain language.
When a customer requests a refund:
- Verify the order is completed or processing
- Use {{tool:woocommerce_create_refund}} with the appropriate amount and reason
- Confirm: "A refund of $[amount] has been processed. It will appear within 5-7 business days."
When a customer reports a damaged or wrong item:
- Use {{tool:woocommerce_update_order}} to add a customer_note documenting the issue
- Proceed with the refund if appropriate
Troubleshooting
401 Unauthorized / woocommerce_rest_cannot_view
The Consumer Key or Consumer Secret is incorrect, or the key was deleted. Regenerate from WooCommerce → Settings → Advanced → REST API.
404 Not Found
The store URL is wrong, or the WooCommerce REST API is not enabled. Verify the URL and check WooCommerce → Settings → Advanced → REST API is enabled. The URL must be the root of the WordPress site, not a subpath.
SSL/HTTPS errors
WooCommerce REST API requires HTTPS. If your store runs on HTTP (local dev), the API calls will fail. Use a tunnel like ngrok for local testing.
woocommerce_rest_product_invalid_id
The product ID doesn't exist in the store. Product IDs from WooCommerce Admin are correct — avoid using post IDs from the WordPress posts table directly.