Automattic\WooCommerce\Blocks\BlockTypes

ProductCollection::get_price_range_query_args()publicWC 1.0

Get query arguments for price range filter. We are adding these extra query arguments to be used in posts_clauses there are 2 special edge cases we wanna handle for Price range filter: Case 1: Prices excluding tax are displayed including tax Case 2: Prices including tax are displayed excluding tax

Both of these cases require us to modify SQL query to get the correct results.

See add_price_range_filter_posts_clauses function in this file for more details.

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

Хуков нет.

Возвращает

Массив. Query arguments.

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

$ProductCollection = new ProductCollection();
$ProductCollection->get_price_range_query_args( $price_range );
$price_range(массив) (обязательный)
Price range with min and max values.

Код ProductCollection::get_price_range_query_args() WC 9.5.1

public function get_price_range_query_args( $price_range ) {
	if ( empty( $price_range ) ) {
		return array();
	}

	return array(
		'isProductCollection' => true,
		'priceRange'          => $price_range,
	);
}