Skip to main content

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:

  1. Go to your WordPress Admin → WooCommerce → Settings → Advanced → REST API
  2. Click Add Key
  3. Set Permissions to Read/Write
  4. Click Generate API Key
  5. Copy the Consumer Key and Consumer Secret
FieldDescription
Store URLYour store's full base URL (e.g. https://mystore.com)
Consumer KeyStarts with ck_
Consumer SecretStarts with cs_

Installing​

  1. Open your project and go to Tools → Add tool → From template
  2. Find WooCommerce and select it
  3. Enter your Store URL, Consumer Key, and Consumer Secret
  4. Select the actions you want to enable
  5. Click Install integration

Actions​

get_order — Get Order​

Retrieves a single order by ID.

Tool reference: {{tool:woocommerce_get_order}}

ParameterRequiredDescription
order_idYesWooCommerce 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}}

ParameterRequiredDescription
statusNopending, processing, on-hold, completed, cancelled, refunded, failed, or any
per_pageNoResults 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}}

ParameterRequiredDescription
order_idYesOrder to update
statusNoNew order status
customer_noteNoNote visible to the customer

create_order — Create Order​

Creates a new order.

Tool reference: {{tool:woocommerce_create_order}}

ParameterRequiredDescription
statusYesInitial status (e.g. pending, processing)
customer_idNoExisting customer ID (0 for guest)
first_nameNoBilling first name
last_nameNoBilling last name
emailNoBilling email address
line_itemsYesJSON array of {product_id, quantity} objects

get_customer — Get Customer​

Retrieves a customer by ID.

Tool reference: {{tool:woocommerce_get_customer}}

ParameterRequiredDescription
customer_idYesWooCommerce 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}}

ParameterRequiredDescription
emailYesCustomer email (must be unique)
first_nameNoFirst name
last_nameNoLast name
usernameNoWordPress username (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}}

ParameterRequiredDescription
customer_idYesCustomer to update
first_nameNoNew first name
last_nameNoNew last name
emailNoNew email address

get_product — Get Product​

Retrieves a product by ID.

Tool reference: {{tool:woocommerce_get_product}}

ParameterRequiredDescription
product_idYesWooCommerce 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}}

ParameterRequiredDescription
statusNopublish, draft, trash
searchNoSearch by product name
per_pageNoResults per page (default 10)

create_product — Create Product​

Creates a new product.

Tool reference: {{tool:woocommerce_create_product}}

ParameterRequiredDescription
nameYesProduct name
typeNosimple, variable, grouped (default: simple)
statusNopublish or draft (default: draft)
priceNoRegular price
descriptionNoFull product description
short_descriptionNoShort excerpt shown on listing pages
skuNoStock Keeping Unit
stock_quantityNoInitial stock count

update_product — Update Product​

Updates a product's details.

Tool reference: {{tool:woocommerce_update_product}}

ParameterRequiredDescription
product_idYesProduct to update
nameNoNew name
priceNoNew regular price
statusNoNew status
stock_quantityNoUpdated stock quantity

create_coupon — Create Coupon​

Creates a discount coupon.

Tool reference: {{tool:woocommerce_create_coupon}}

ParameterRequiredDescription
codeYesCoupon code (case-insensitive)
discount_typeYespercent or fixed_cart
amountYesDiscount value (percent or fixed amount)
individual_useNotrue to prevent combining with other coupons
usage_limitNoMaximum number of times this coupon can be used
expiresNoExpiry 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}}

ParameterRequiredDescription
order_idYesOrder to refund
amountYesRefund amount
reasonNoReason for the refund
process_payment_refundNotrue 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.

Was this page helpful?