Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orders: Add doc for order actions #252

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions source/includes/wp-api-v3/_order-actions.md
Original file line number Diff line number Diff line change
@@ -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 ###

<div class="api-endpoint">
<div class="endpoint-data">
<i class="label label-post">POST</i>
<h6>/wp-json/wc/v3/orders/&lt;id&gt;/actions/send_order_details</h6>
</div>
</div>

```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
<?php
print_r($woocommerce->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 [email protected], via REST API."
}
```

```json
{
"code": "woocommerce_rest_missing_email",
"message": "Order does not have an email address.",
"data": {
"status": 400
}
}
```
1 change: 1 addition & 0 deletions source/index.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down