Skip to content

Commit df4d563

Browse files
authored
Merge pull request #252 from woocommerce/fix/251/order-actions-endpoint
Orders: Add doc for order actions
2 parents 5bc6e80 + 91a5d70 commit df4d563

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Order actions #
2+
3+
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.
4+
5+
_Note: currently only one action is available, other actions will be introduced at a later time._
6+
7+
## Send order details to customer ##
8+
9+
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.
10+
11+
### HTTP request ###
12+
13+
<div class="api-endpoint">
14+
<div class="endpoint-data">
15+
<i class="label label-post">POST</i>
16+
<h6>/wp-json/wc/v3/orders/&lt;id&gt;/actions/send_order_details</h6>
17+
</div>
18+
</div>
19+
20+
```shell
21+
curl -X POST https://example.com/wp-json/wc/v3/orders/723/actions/send_order_details \
22+
-u consumer_key:consumer_secret
23+
```
24+
25+
```javascript
26+
WooCommerce.post("orders/723/actions/send_order_details")
27+
.then((response) => {
28+
console.log(response.data);
29+
})
30+
.catch((error) => {
31+
console.log(error.response.data);
32+
});
33+
```
34+
35+
```php
36+
<?php
37+
print_r($woocommerce->post('orders/723/actions/send_order_details'));
38+
?>
39+
```
40+
41+
```python
42+
print(wcapi.post("orders/723/actions/send_order_details").json())
43+
```
44+
45+
```ruby
46+
woocommerce.post("orders/723/actions/send_order_details").parsed_response
47+
```
48+
49+
> JSON response examples:
50+
51+
```json
52+
{
53+
"message": "Order details sent to woo@example.com, via REST API."
54+
}
55+
```
56+
57+
```json
58+
{
59+
"code": "woocommerce_rest_missing_email",
60+
"message": "Order does not have an email address.",
61+
"data": {
62+
"status": 400
63+
}
64+
}
65+
```

source/index.html.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ includes:
2424
- wp-api-v3/coupons
2525
- wp-api-v3/customers
2626
- wp-api-v3/orders
27+
- wp-api-v3/order-actions
2728
- wp-api-v3/order-notes
2829
- wp-api-v3/order-refunds
2930
- wp-api-v3/products

0 commit comments

Comments
 (0)