WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

Automattic\WooCommerce\Blocks\StoreApi\Utilities

ProductQueryFilters::get_filtered_price() public WC 1.0

Get filtered min price for current products.

{} Это метод класса: ProductQueryFilters{}

Хуков нет.

Возвращает

Массив.

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

$ProductQueryFilters = new ProductQueryFilters();
$ProductQueryFilters->get_filtered_price( $request );
$request(\WP_REST_Request) (обязательный)
The request object.

Код ProductQueryFilters::get_filtered_price() WC 4.7.1

<?php
public function get_filtered_price( $request ) {
	global $wpdb;

	// Regenerate the products query without min/max price request params.
	unset( $request['min_price'], $request['max_price'] );

	// Grab the request from the WP Query object, and remove SQL_CALC_FOUND_ROWS and Limits so we get a list of all products.
	$product_query = new ProductQuery();

	add_filter( 'posts_clauses', array( $product_query, 'add_query_clauses' ), 10, 2 );
	add_filter( 'posts_pre_query', '__return_empty_array' );

	$query_args                   = $product_query->prepare_objects_query( $request );
	$query_args['no_found_rows']  = true;
	$query_args['posts_per_page'] = -1;
	$query                        = new \WP_Query();
	$result                       = $query->query( $query_args );
	$product_query_sql            = $query->request;

	remove_filter( 'posts_clauses', array( $product_query, 'add_query_clauses' ), 10 );
	remove_filter( 'posts_pre_query', '__return_empty_array' );

	$price_filter_sql = "
		SELECT min( min_price ) as min_price, MAX( max_price ) as max_price
		FROM {$wpdb->wc_product_meta_lookup}
		WHERE product_id IN ( {$product_query_sql} )
	";

	return $wpdb->get_row( $price_filter_sql ); // phpcs:ignore
}