WordPress at Your Fingertips
function is not described

wc_create_order_note() WC 3.2.0

Create an order note.

No Hooks.


Int|WP_Error. Integer when created or WP_Error when found an error.


wc_create_order_note( $order_id, $note, $is_customer_note, $added_by_user );
$order_id(int) (required)
Order ID.
$note(string) (required)
Note to add.
If is a costumer note.
Default: false
If note is create by an user.
Default: false


Since 3.2.0 Introduced.

Code of wc_create_order_note() WC 5.8.0

function wc_create_order_note( $order_id, $note, $is_customer_note = false, $added_by_user = false ) {
	$order = wc_get_order( $order_id );

	if ( ! $order ) {
		return new WP_Error( 'invalid_order_id', __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 400 ) );

	return $order->add_order_note( $note, (int) $is_customer_note, $added_by_user );