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

RefundPreviewSchema::get_base_item_schemaprivateWC 1.0

Schema for an item entry in the shipping or fees sections.

Method of the class: RefundPreviewSchema{}

No Hooks.

Returns

Array.

Usage

// private - for code of main (parent) class only
$result = $this->get_base_item_schema(): array;

RefundPreviewSchema::get_base_item_schema() code WC 11.0.0

private function get_base_item_schema(): array {
	return array(
		'type'       => 'object',
		'properties' => array(
			'id'       => array(
				'description' => __( 'The original order line item ID.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
				'readonly'    => true,
			),
			'name'     => array(
				'description' => __( 'The line item name.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
				'readonly'    => true,
			),
			'quantity' => array(
				'description' => __( 'The quantity being refunded. Null when the refund was specified by amount only.', 'woocommerce' ),
				'type'        => array( 'integer', 'null' ),
				'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
				'readonly'    => true,
			),
			'subtotal' => array(
				'description' => __( 'The refund subtotal for this item (excluding tax).', 'woocommerce' ),
				'type'        => 'string',
				'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
				'readonly'    => true,
			),
			'tax'      => array(
				'description' => __( 'The tax amount for this item.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
				'readonly'    => true,
			),
			'total'    => array(
				'description' => __( 'The refund total for this item (tax-inclusive).', 'woocommerce' ),
				'type'        => 'string',
				'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
				'readonly'    => true,
			),
		),
	);
}