diff --git a/source/includes/wp-api-v3/_order-actions.md b/source/includes/wp-api-v3/_order-actions.md new file mode 100644 index 0000000..c551bd9 --- /dev/null +++ b/source/includes/wp-api-v3/_order-actions.md @@ -0,0 +1,65 @@ +# 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 one action is 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, if the order contains a customer email address. + +### HTTP request ### + +
+
+ POST +
/wp-json/wc/v3/orders/<id>/actions/send_order_details
+
+
+ +```shell +curl -X POST https://example.com/wp-json/wc/v3/orders/723/actions/send_order_details \ + -u consumer_key:consumer_secret +``` + +```javascript +WooCommerce.post("orders/723/actions/send_order_details") + .then((response) => { + console.log(response.data); + }) + .catch((error) => { + console.log(error.response.data); + }); +``` + +```php +post('orders/723/actions/send_order_details')); +?> +``` + +```python +print(wcapi.post("orders/723/actions/send_order_details").json()) +``` + +```ruby +woocommerce.post("orders/723/actions/send_order_details").parsed_response +``` + +> JSON response examples: + +```json +{ + "message": "Order details sent to woo@example.com, via REST API." +} +``` + +```json +{ + "code": "woocommerce_rest_missing_email", + "message": "Order does not have an email address.", + "data": { + "status": 400 + } +} +``` diff --git a/source/index.html.md b/source/index.html.md index 28684b9..126d8a9 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -24,6 +24,7 @@ includes: - wp-api-v3/coupons - wp-api-v3/customers - wp-api-v3/orders + - wp-api-v3/order-actions - wp-api-v3/order-notes - wp-api-v3/order-refunds - wp-api-v3/products