Changes to the Send Order Details REST API Endpoint

In WooCommerce 9.5 we introduced a REST API endpoint, wc/v3/orders/<id>/actions/send_order_details, to trigger an email containing details of the order to the customer. When making a request to this endpoint, there is an optional parameter, email, that allows you to set the billing email for the order so that you can add an email address and send the email message all in one request. Prior to WooCommerce 9.8, if the order already had a billing email set, it would get silently overwritten.

In WooCommerce 9.8 we’re modifying that a bit so that you will get an error response (and the email won’t be sent) if you try to use the email parameter with an order that already has a billing email and the two emails aren’t the same. However, you can still successfully overwrite the billing email and send the message in one request if you also use the new force_email_update parameter, set to true. This helps ensure that changing an existing billing email for an order is intentional.

This also makes the send_order_details endpoint match the behavior of another new endpoint that is being added in WooCommerce 9.8, wc/v3/orders/<id>/actions/send_email.

Details about both of these endpoints are in our REST API docs, which will be updated with the release of WooCommerce 9.8.

How can I tell if this affects me?

This might affect you if you are using the wc/v3/orders/<id>/actions/send_order_details REST API endpoint introduced in WooCommerce 9.5, and you are using the email parameter to set the billing email of the order.

What action should I take?

If you are affected, make sure your code is designed to handle an error if the order already has a billing email set, and perhaps consider using the force_email_update parameter to ensure that your flow is not interrupted.


Leave a Reply

Your email address will not be published. Required fields are marked *