WC_REST_Shipping_Zone_Locations_V2_Controller::get_item_schema()publicWC 1.0

Get the Shipping Zone Locations schema, conforming to JSON Schema

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

Хуков нет.

Возвращает

Массив.

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

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

Код WC_REST_Shipping_Zone_Locations_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_zone_location',
		'type'       => 'object',
		'properties' => array(
			'code' => array(
				'description' => __( 'Shipping zone location code.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'type' => array(
				'description' => __( 'Shipping zone location type.', 'woocommerce' ),
				'type'        => 'string',
				'default'     => 'country',
				'enum'        => array(
					'postcode',
					'state',
					'country',
					'continent',
				),
				'context'     => array( 'view', 'edit' ),
			),
		),
	);

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