WC_API_Orders::edit_order()
Edit an order
API v1 only allows updating the status of an order
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. |
WC_API_Orders::edit_order() WC API Orders::edit order code WC 7.7.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 ); }