WordPress at Your Fingertips
function is not described

WC_API_Orders::edit_order() public WC 2.1

Edit an order

API v1 only allows updating the status of an order

{} It's a method of the class: WC_API_Orders{}

No Hooks.

Return

Array|WP_Error.

Usage

$WC_API_Orders = new WC_API_Orders();
$WC_API_Orders->edit_order( $id, $data );
$id(int) (required)
the order ID
$data(array) (required)
-

Changelog

Since 2.1 Introduced.

Code of WC_API_Orders::edit_order() WC 5.6.0

public function edit_order( $id, $data ) {

	$id = $this->validate_request( $id, 'shop_order', 'edit' );

	if ( is_wp_error( $id ) ) {
		return $id;
	}

	$order = wc_get_order( $id );

	if ( ! empty( $data['status'] ) ) {

		$order->update_status( $data['status'], isset( $data['note'] ) ? $data['note'] : '' );
	}

	return $this->get_order( $id );
}