Automattic\WooCommerce\Internal\RestApi\Routes\V4\Orders\Schema

AbstractLineItemSchema::get_meta_data_schemaprotectedWC 1.0

Get the meta data schema shared by all line item schemas.

Method of the class: AbstractLineItemSchema{}

No Hooks.

Returns

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_meta_data_schema(): array;

AbstractLineItemSchema::get_meta_data_schema() code WC 10.4.3

protected function get_meta_data_schema(): array {
	return array(
		'description' => __( 'Meta data.', 'woocommerce' ),
		'type'        => 'array',
		'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
		'items'       => array(
			'type'       => 'object',
			'properties' => array(
				'id'            => array(
					'description' => __( 'Meta ID.', 'woocommerce' ),
					'type'        => 'integer',
					'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
					'readonly'    => true,
				),
				'key'           => array(
					'description' => __( 'Meta key.', 'woocommerce' ),
					'type'        => 'string',
					'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
				),
				'value'         => array(
					'description' => __( 'Meta value.', 'woocommerce' ),
					'type'        => array( 'null', 'object', 'string', 'number', 'boolean', 'integer', 'array' ),
					'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
				),
				'display_key'   => array(
					'description' => __( 'Meta key for UI display.', 'woocommerce' ),
					'type'        => 'string',
					'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
				),
				'display_value' => array(
					'description' => __( 'Meta value for UI display.', 'woocommerce' ),
					'type'        => array( 'null', 'object', 'string', 'number', 'boolean', 'integer', 'array' ),
					'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
				),
			),
		),
	);
}