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

OrderSchema::add_cogs_related_schemaprivate staticWC 1.0

Add the Cost of Goods Sold related fields to the schema.

Method of the class: OrderSchema{}

No Hooks.

Returns

Array. The updated schema.

Usage

$result = OrderSchema::add_cogs_related_schema( $schema ): array;
$schema(array) (required)
The original schema.

OrderSchema::add_cogs_related_schema() code WC 10.4.3

private static function add_cogs_related_schema( array $schema ): array {
	$schema['cost_of_goods_sold'] = array(
		'description' => __( 'Cost of Goods Sold data.', 'woocommerce' ),
		'type'        => 'object',
		'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
		'properties'  => array(
			'total_value' => array(
				'description' => __( 'Total value of the Cost of Goods Sold for the order.', 'woocommerce' ),
				'type'        => 'number',
				'readonly'    => true,
				'context'     => self::VIEW_EDIT_EMBED_CONTEXT,
			),
		),
	);
	return $schema;
}