WC_CLI_REST_Command::delete_item( array $args, array $assoc_args )

Delete an existing item.


Description Description


Parameters Parameters

$args

(Required) WP-CLI positional arguments.

$assoc_args

(Required) WP-CLI associative arguments.


Top ↑

Source Source

File: includes/cli/class-wc-cli-rest-command.php

	public function delete_item( $args, $assoc_args ) {
		list( $status, $body ) = $this->do_request( 'DELETE', $this->get_filled_route( $args ), $assoc_args );
		if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'porcelain' ) ) {
			WP_CLI::line( $body['id'] );
		} else {
			if ( empty( $assoc_args['force'] ) ) {
				WP_CLI::success( __( 'Trashed', 'woocommerce' ) . " {$this->name} {$body['id']}" );
			} else {
				WP_CLI::success( __( 'Deleted', 'woocommerce' ) . " {$this->name} {$body['id']}." );
			}
		}
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.