WooCommerce Code Reference

ProductQueryFilters
in package

Product Query filters class.

Table of Contents

get_attribute_counts()  : array<string|int, mixed>
Get attribute counts for the current products.
get_filtered_price()  : object
Get filtered min price for current products.
get_rating_counts()  : array<string|int, mixed>
Get rating counts for the current products.
get_stock_status_counts()  : array<string|int, mixed>
Get stock status counts for the current products.
generate_stock_status_count_query()  : false|string
Generate calculate query by stock status.

Methods

get_attribute_counts()

Get attribute counts for the current products.

public get_attribute_counts(WP_REST_Request $request[, array<string|int, mixed> $attributes = [] ]) : array<string|int, mixed>
Parameters
$request : WP_REST_Request

The request object.

$attributes : array<string|int, mixed> = []

Attributes to count, either names or ids.

Return values
array<string|int, mixed>termId=>count pairs.

get_filtered_price()

Get filtered min price for current products.

public get_filtered_price(WP_REST_Request $request) : object
Parameters
$request : WP_REST_Request

The request object.

Return values
object

get_rating_counts()

Get rating counts for the current products.

public get_rating_counts(WP_REST_Request $request) : array<string|int, mixed>
Parameters
$request : WP_REST_Request

The request object.

Return values
array<string|int, mixed>rating=>count pairs.

get_stock_status_counts()

Get stock status counts for the current products.

public get_stock_status_counts(WP_REST_Request $request) : array<string|int, mixed>
Parameters
$request : WP_REST_Request

The request object.

Return values
array<string|int, mixed>status=>count pairs.

generate_stock_status_count_query()

Generate calculate query by stock status.

private generate_stock_status_count_query(string $status, string $product_query_sql, array<string|int, mixed> $stock_status_options) : false|string
Parameters
$status : string

status to calculate.

$product_query_sql : string

product query for current filter state.

$stock_status_options : array<string|int, mixed>

available stock status options.

Return values
false|string