Automattic\WooCommerce\Admin\API\Reports\Categories

Controller::get_item_schema()publicWC 1.0

Get the Report's schema, conforming to JSON Schema.

Метод класса: Controller{}

Хуков нет.

Возвращает

Массив.

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

$Controller = new Controller();
$Controller->get_item_schema();

Код Controller::get_item_schema() WC 8.7.0

public function get_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'report_categories',
		'type'       => 'object',
		'properties' => array(
			'category_id'    => array(
				'description' => __( 'Category ID.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'items_sold'     => array(
				'description' => __( 'Amount of items sold.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'net_revenue'    => array(
				'description' => __( 'Total sales.', 'woocommerce' ),
				'type'        => 'number',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'orders_count'   => array(
				'description' => __( 'Number of orders.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'products_count' => array(
				'description' => __( 'Amount of products.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'extended_info'  => array(
				'name' => array(
					'type'        => 'string',
					'readonly'    => true,
					'context'     => array( 'view', 'edit' ),
					'description' => __( 'Category name.', 'woocommerce' ),
				),
			),
		),
	);

	return $this->add_additional_fields_schema( $schema );
}