WordPress at Your Fingertips
function is not described

WC_CLI_REST_Command::delete_item() public WC 1.0

Delete an existing item.

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

No Hooks.

Return

null. Nothing.

Usage

$WC_CLI_REST_Command = new WC_CLI_REST_Command();
$WC_CLI_REST_Command->delete_item( $args, $assoc_args );
$args(array) (required)
WP-CLI positional arguments.
$assoc_args(array) (required)
WP-CLI associative arguments.

Code of WC_CLI_REST_Command::delete_item() WC 5.9.0

public function delete_item( $args, $assoc_args ) {
	list( $status, $body ) = $this->do_request( 'DELETE', $this->get_filled_route( $args ), $assoc_args );
	$object_id = isset( $body['id'] ) ? $body['id'] : '';
	if ( ! $object_id && isset( $body['slug'] ) ) {
		$object_id = $body['slug'];
	}

	if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'porcelain' ) ) {
		WP_CLI::line( $object_id );
	} else {
		if ( empty( $assoc_args['force'] ) ) {
			WP_CLI::success( __( 'Trashed', 'woocommerce' ) . " {$this->name} {$object_id}" );
		} else {
			WP_CLI::success( __( 'Deleted', 'woocommerce' ) . " {$this->name} {$object_id}." );
		}
	}
}