WC_REST_Taxes_V1_Controller::get_item_schema()publicWC 1.0

Get the Taxes schema, conforming to JSON Schema.

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

Хуков нет.

Возвращает

Массив.

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

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

Код WC_REST_Taxes_V1_Controller::get_item_schema() WC 8.7.0

public function get_item_schema() {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'tax',
		'type'       => 'object',
		'properties' => array(
			'id'       => array(
				'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'country'  => array(
				'description' => __( 'Country ISO 3166 code.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'state'    => array(
				'description' => __( 'State code.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'postcode' => array(
				'description' => __( 'Postcode / ZIP.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'city'     => array(
				'description' => __( 'City name.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'rate'     => array(
				'description' => __( 'Tax rate.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'name'     => array(
				'description' => __( 'Tax rate name.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
			),
			'priority' => array(
				'description' => __( 'Tax priority.', 'woocommerce' ),
				'type'        => 'integer',
				'default'     => 1,
				'context'     => array( 'view', 'edit' ),
			),
			'compound' => array(
				'description' => __( 'Whether or not this is a compound rate.', 'woocommerce' ),
				'type'        => 'boolean',
				'default'     => false,
				'context'     => array( 'view', 'edit' ),
			),
			'shipping' => array(
				'description' => __( 'Whether or not this tax rate also gets applied to shipping.', 'woocommerce' ),
				'type'        => 'boolean',
				'default'     => true,
				'context'     => array( 'view', 'edit' ),
			),
			'order'    => array(
				'description' => __( 'Indicates the order that will appear in queries.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
			),
			'class'    => array(
				'description' => __( 'Tax class.', 'woocommerce' ),
				'type'        => 'string',
				'default'     => 'standard',
				'enum'        => array_merge( array( 'standard' ), WC_Tax::get_tax_class_slugs() ),
				'context'     => array( 'view', 'edit' ),
			),
		),
	);

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