Create WooCommerce Order
woocommerce_create_orderCreate an order with required line items; WooCommerce automatically calculates totals, tax, and adjusts stock. Supports guest or registered customer orders with optional payment and status.
Instructions
Create a new order with one or more line items. WooCommerce will calculate totals, tax, and stock reduction (for statuses that trigger it) automatically.
Args:
status: order status (default: pending)
customer_id (number, optional): omit for a guest order
payment_method / payment_method_title (string, optional)
set_paid (boolean, optional): mark as paid immediately
billing / shipping (object, optional): address fields
line_items (array, required): [{product_id, variation_id?, quantity}]
customer_note (string, optional)
response_format ('markdown'|'json'): default 'markdown'
Returns: The newly created order object with its assigned ID and calculated totals.
Examples:
Use when: "create an order for 2x product 55 for customer 10" -> customer_id=10, line_items=[{product_id:55, quantity:2}]
Error Handling:
Returns "Error: Bad request (400)" if a product_id/variation_id doesn't exist or is out of stock with backorders disabled.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Initial order status (default: pending) | pending |
| billing | No | ||
| set_paid | No | If true, mark the order as paid immediately | |
| shipping | No | ||
| line_items | Yes | Products to include on the order | |
| customer_id | No | Existing customer ID to attach this order to (omit for a guest order) | |
| customer_note | No | Note left by/for the customer | |
| payment_method | No | Payment method ID, e.g. 'bacs', 'cod', 'stripe' | |
| response_format | No | Output format: 'markdown' for human-readable text or 'json' for machine-readable structured data | markdown |
| payment_method_title | No | Human-readable payment method label |