Automattic\WooCommerce\StoreApi\Routes\V1

ProductCollectionData::get_collection_params()publicWC 1.0

Get the query params for collections of products.

Method of the class: ProductCollectionData{}

No Hooks.

Return

Array.

Usage

$ProductCollectionData = new ProductCollectionData();
$ProductCollectionData->get_collection_params();

ProductCollectionData::get_collection_params() code WC 9.4.2

public function get_collection_params() {
	$params = ( new Products( $this->schema_controller, $this->schema ) )->get_collection_params();

	$params['calculate_price_range'] = [
		'description' => __( 'If true, calculates the minimum and maximum product prices for the collection.', 'woocommerce' ),
		'type'        => 'boolean',
		'default'     => false,
	];

	$params['calculate_stock_status_counts'] = [
		'description' => __( 'If true, calculates stock counts for products in the collection.', 'woocommerce' ),
		'type'        => 'boolean',
		'default'     => false,
	];

	$params['calculate_attribute_counts'] = [
		'description' => __( 'If requested, calculates attribute term counts for products in the collection.', 'woocommerce' ),
		'type'        => 'array',
		'items'       => [
			'type'       => 'object',
			'properties' => [
				'taxonomy'   => [
					'description' => __( 'Taxonomy name.', 'woocommerce' ),
					'type'        => 'string',
					'context'     => [ 'view', 'edit' ],
					'readonly'    => true,
				],
				'query_type' => [
					'description' => __( 'Filter condition	 being performed which may affect counts. Valid values include "and" and "or".', 'woocommerce' ),
					'type'        => 'string',
					'enum'        => [ 'and', 'or' ],
					'context'     => [ 'view', 'edit' ],
					'readonly'    => true,
				],
			],
		],
		'default'     => [],
	];

	$params['calculate_rating_counts'] = [
		'description' => __( 'If true, calculates rating counts for products in the collection.', 'woocommerce' ),
		'type'        => 'boolean',
		'default'     => false,
	];

	return $params;
}