WC_REST_Shipping_Methods_V2_Controller::get_item_schema()publicWC 1.0

Get the shipping method schema, conforming to JSON Schema.

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

Хуков нет.

Возвращает

Массив.

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

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

Код WC_REST_Shipping_Methods_V2_Controller::get_item_schema() WC 9.3.3

public function get_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'shipping_method',
		'type'       => 'object',
		'properties' => array(
			'id'          => array(
				'description' => __( 'Method ID.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'title'       => array(
				'description' => __( 'Shipping method title.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
			'description' => array(
				'description' => __( 'Shipping method description.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view' ),
				'readonly'    => true,
			),
		),
	);

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