WordPress filter hook
woocommerce_get_min_max_price_meta_query
Defined by WooCommerce and fired by 5 plugins in total, running on 7M+ sites between them.
“WooCommerce core filter: Filters the meta query for min/max price filtering.”
How to use woocommerce_get_min_max_price_meta_query
It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'woocommerce_get_min_max_price_meta_query', function( $value, $args ) {
// Change $value here.
return $value;
}, 10, 2 );Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
5 plugins that fire woocommerce_get_min_max_price_meta_query
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WooCommerce7+ million installs
apply_filters( 'woocommerce_get_min_max_price_meta_query', array( 'key' => '_price', 'value' => array( $current_min_price, $current_max_price ), 'compare' => 'BETWEEN', 'type' => 'DECIMAL(10,' . wc_get_price_decimals() . ')', ), $args )includes/wc-deprecated-functions.php:1130 -
Product Table & List Builder for WooCommerce10,000+ installs
apply_filters( 'woocommerce_get_min_max_price_meta_query', array( 'price_filter' => true, 'key' => '_price', 'value' => array($current_min_price, $current_max_price), 'compare' => 'BETWEEN', 'type' => 'DECIMAL(10,' . wc_get_price_decimals() . ')', ), $filter_info )class-wc-shortcode-product-table.php:934 -
CoCart900+ installs
apply_filters( 'woocommerce_get_min_max_price_meta_query', array( 'key' => '_price', 'value' => array( $current_min_price, $current_max_price ), 'compare' => 'BETWEEN', 'type' => 'DECIMAL(10,' . wc_get_price_decimals() . ')', ), $args )includes/cocart-rest-functions.php:612 -
TABLEiT20+ installs
apply_filters( 'woocommerce_get_min_max_price_meta_query', array( 'price_filter' => true, 'key' => '_price', 'value' => array($current_min_price, $current_max_price), 'compare' => 'BETWEEN', 'type' => 'DECIMAL(10,' . wc_get_price_decimals() . ')', ), $filter_info )class-wc-shortcode-product-table.php:795 -
Swift Shop for WooCommerceFewer than 10 installs
apply_filters( 'woocommerce_get_min_max_price_meta_query', [ 'key' => '_price', 'value' => [$current_min_price, $current_max_price], 'compare' => 'BETWEEN', 'type' => 'DECIMAL(10,' . wc_get_price_decimals() . ')' ], $args )includes/Utilities/SSFW_Helper.php:46
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.