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.

Method of the class: ProductCollection{}

No Hooks.


Array. Query arguments.


$ProductCollection = new ProductCollection();
$ProductCollection->get_price_range_query_args( $price_range );
$price_range(array) (required)
Price range with min and max values.

ProductCollection::get_price_range_query_args() code WC 9.0.1

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

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