woof_get_filtered_price_query
woof_get_filtered_price_query
Позволяет модифицировать SQL-запрос для получения минимальной и максимальной цены среди отфильтрованных товаров.
Parameters
$sql (string) — SQL-запрос для выборки цен
Source File
classes/helper.php
Code Example
add_filter('woof_get_filtered_price_query', function($sql) {
// Modify the price range SQL query
// For example, to exclude certain product types from price calculation
global $wpdb;
$sql .= " AND {$wpdb->posts}.post_type NOT IN ('excluded_type')";
return $sql;
});
Usage Notes
- Add this code to your theme's
functions.phpfile or a custom plugin. - The hook is applied during the filtering process — changes take effect immediately.
- Always return the expected value type from the callback function.