Automattic\WooCommerce\StoreApi\Routes\V1

ProductCollectionData::get_collection_params()publicWC 1.0

Get the query params for collections of products.

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

Хуков нет.

Возвращает

Массив.

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

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

Код ProductCollectionData::get_collection_params() WC 8.7.0

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;
}