WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_REST_Order_Notes_V1_Controller::delete_item() public WC 1.0

Delete a single order note.

Это метод класса: WC_REST_Order_Notes_V1_Controller{}

Хуки из метода
Возвращает

WP_REST_Response/WP_Error.

Использование

$WC_REST_Order_Notes_V1_Controller = new WC_REST_Order_Notes_V1_Controller();
$WC_REST_Order_Notes_V1_Controller->delete_item( $request );
$request(WP_REST_Request) (обязательный)
Full details about the request.

Код WC_REST_Order_Notes_V1_Controller::delete_item() WC 4.5.2

woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php
<?php
public function delete_item( $request ) {
	$id    = (int) $request['id'];
	$force = isset( $request['force'] ) ? (bool) $request['force'] : false;

	// We don't support trashing for this type, error out.
	if ( ! $force ) {
		return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Webhooks do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) );
	}

	$order = wc_get_order( (int) $request['order_id'] );

	if ( ! $order || $this->post_type !== $order->get_type() ) {
		return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) );
	}

	$note = get_comment( $id );

	if ( empty( $id ) || empty( $note ) || intval( $note->comment_post_ID ) !== intval( $order->get_id() ) ) {
		return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) );
	}

	$request->set_param( 'context', 'edit' );
	$response = $this->prepare_item_for_response( $note, $request );

	$result = wc_delete_order_note( $note->comment_ID );

	if ( ! $result ) {
		return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), 'order_note' ), array( 'status' => 500 ) );
	}

	/**
	 * Fires after a order note is deleted or trashed via the REST API.
	 *
	 * @param WP_Comment       $note     The deleted or trashed order note.
	 * @param WP_REST_Response $response The response data.
	 * @param WP_REST_Request  $request  The request sent to the API.
	 */
	do_action( 'woocommerce_rest_delete_order_note', $note, $response, $request );

	return $response;
}