wc_delete_order_note()WC 3.2.0

Delete an order note.

Hooks from the function

Return

true|false. True on success, false on failure.

Usage

wc_delete_order_note( $note_id );
$note_id(int) (required)
Order note.

Changelog

Since 3.2.0 Introduced.

wc_delete_order_note() code WC 9.6.0

function wc_delete_order_note( $note_id ) {
	$note = wc_get_order_note( $note_id );
	if ( $note && wp_delete_comment( $note_id, true ) ) {
		/**
		 * Action hook fired after an order note is deleted.
		 *
		 * @param int      $note_id Order note ID.
		 * @param stdClass $note    Object with the deleted order note details.
		 *
		 * @since 9.1.0
		 */
		do_action( 'woocommerce_order_note_deleted', $note_id, $note );

		return true;
	}

	return false;
}