Automattic\WooCommerce\StoreApi\Routes\V1
ProductCollectionData::get_collection_params
Get the query params for collections of products.
Метод класса: ProductCollectionData{}
Хуков нет.
Возвращает
Массив.
Использование
$ProductCollectionData = new ProductCollectionData(); $ProductCollectionData->get_collection_params();
Код ProductCollectionData::get_collection_params() ProductCollectionData::get collection params WC 10.5.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,
];
$params['calculate_taxonomy_counts'] = [
'description' => __( 'If requested, calculates taxonomy term counts for products in the collection.', 'woocommerce' ),
'type' => 'array',
'items' => [
'type' => 'string',
'description' => __( 'Taxonomy name.', 'woocommerce' ),
],
'default' => [],
];
return $params;
}