omy__and_queries );
foreach ( $counts as $key => $value ) {
$data['attribute_counts'][] = (object) [
'term' => $key,
'count' => $value,
];
}
}
}
if ( ! empty( $request['calculate_rating_counts'] ) ) {
$filter_request = clone $request;
$counts = $filters->get_rating_counts( $filter_request );
$data['rating_counts'] = [];
foreach ( $counts as $key => $value ) {
$data['rating_counts'][] = (object) [
'rating' => $key,
'count' => $value,
];
}
}
return rest_ensure_response( $this->schema->get_item_response( $data ) );
}
/**
* Get the query params for collections of products.
*
* @return array
*/
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;
}
}
Warning: Class "Automattic\WooCommerce\StoreApi\Routes\V1\ProductCollectionData" not found in /home/valigeria/public_html/wp-content/plugins/woocommerce/src/StoreApi/deprecated.php on line 73
Fatal error: Uncaught Error: Failed opening required '/home/valigeria/public_html/wp-content/plugins/woocommerce/includes/wc-coupon-functions.php' (include_path='.:/opt/alt/php81/usr/share/pear:/opt/alt/php81/usr/share/php:/usr/share/pear:/usr/share/php') in /home/valigeria/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php:20
Stack trace:
#0 /home/valigeria/public_html/wp-content/plugins/woocommerce/includes/class-woocommerce.php(562): include_once()
#1 /home/valigeria/public_html/wp-content/plugins/woocommerce/includes/class-woocommerce.php(193): WooCommerce->includes()
#2 /home/valigeria/public_html/wp-content/plugins/woocommerce/includes/class-woocommerce.php(152): WooCommerce->__construct()
#3 /home/valigeria/public_html/wp-content/plugins/woocommerce/woocommerce.php(51): WooCommerce::instance()
#4 /home/valigeria/public_html/wp-content/plugins/woocommerce/woocommerce.php(66): WC()
#5 /home/valigeria/public_html/wp-settings.php(517): include_once('/home/valigeria...')
#6 /home/valigeria/public_html/wp-config.php(111): require_once('/home/valigeria...')
#7 /home/valigeria/public_html/wp-load.php(50): require_once('/home/valigeria...')
#8 /home/valigeria/public_html/wp-blog-header.php(13): require_once('/home/valigeria...')
#9 /home/valigeria/public_html/index.php(17): require('/home/valigeria...')
#10 {main}
thrown in /home/valigeria/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 20