Skip to main content

Order actions

The order actions API allows you to perform specific actions with existing orders like you can from the Edit Order screen in the web app.

Note: currently only some actions are available, other actions will be introduced at a later time.

Send order details to customer

This endpoint allows you to trigger an email to the customer with the details of their order. In case the order doesn't yet have a billing email set, you can specify an email recipient. However, if the order does have an existing billing email, this will return an error, unless you also specify that the existing email should be overwritten by using the force_email_update parameter.

POST /wp-json/wc/v3/orders/<id>/actions/send_order_details
curl -X POST https://example.com/wp-json/wc/v3/orders/723/actions/send_order_details \
-u consumer_key:consumer_secret \
-d '{
"email": "somebody@example.com",
"force_email_update": true
}'
{
"code": "woocommerce_rest_missing_email",
"message": "Order does not have an email address.",
"data": {
"status": 400
}
}

Send order notification email to customer

This endpoint allows you to trigger an email to a customer about the status of their order. This is similar to the send_order_details endpoint, but allows you to specify which email template to send, based on which email templates are relevant to the order. For example, an order that is on hold has the customer_on_hold_order template available. A completed order that also has a partial refund has both the customer_completed_order and customer_refunded_order templates available. Specifying the customer_invoice template is the same as using the send_order_details endpoint.

POST /wp-json/wc/v3/orders/<id>/actions/send_email
curl -X POST https://example.com/wp-json/wc/v3/orders/723/actions/send_email \
-u consumer_key:consumer_secret \
-d '{
"template_id": "customer_completed_order",
"email": "somebody@example.com",
"force_email_update": true
}'
{
"code": "woocommerce_rest_invalid_email_template",
"message": "customer_completed_order is not a valid template for this order.",
"data": {
"status": 400
}
}

Get available email templates for an order

This endpoint allows you to retrieve a list of email templates that are available for the specified order. You can also get this data embedded in the response for the orders endpoint.

GET /wp-json/wc/v3/orders/<id>/actions/email_templates
curl -X GET https://example.com/wp-json/wc/v3/orders/723/actions/email_templates \
-u consumer_key:consumer_secret