WordPress at Your Fingertips
function is not described

WC_CLI_REST_Command::create_item() public WC 1.0

Create a new 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->create_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::create_item() WC 5.9.0

public function create_item( $args, $assoc_args ) {
	$assoc_args            = self::decode_json( $assoc_args );
	list( $status, $body ) = $this->do_request( 'POST', $this->get_filled_route( $args ), $assoc_args );
	if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'porcelain' ) ) {
		WP_CLI::line( $body['id'] );
	} else {
		WP_CLI::success( "Created {$this->name} {$body['id']}." );
	}
}