Allow users to filter content based on a numerical field value. This facet might consist of three elements: “max” and “min” input boxes, a slider, and a range presented as a “radio” button. In the settings, you can decide what elements will be displayed.
The number range filter type will be selected automatically if you pick “price” as the filter source.
The range filter type will be able to select only if the filter data source consists of numeric values. FiboFilters will first analyze this data, and then allow filter selection that corresponds with the data.
![Number range with prices](https://fibofilters.com/wp-content/uploads/2023/06/price-range-full.png)
Available options
Number format
The price format is set automatically, according to WooCommerce settings → General → Currency Options
.
For values different from price, the thousands separator and decimal point are taken from the global variable $wp_locale
. They can be overridden using a PHP snippet:
add_filter( 'fibofilters/config/number_format', function ( $number_format ) { return [ 'thousands_sep' => ' ', 'decimal_point' => ',', ]; } );
Depending on the filter’s purpose, you might want to display numeric values with a prefix, for example, ~50
(approximately 50), a suffix 70dB
(70 decibels), or with a number precision 15.00
(two digits after decimal).
These values can also be changed with a PHP snippet. For example, you can change the number format to ~12.0”
, meaning: approximately 12 inches with 1 number precision.
add_filter( 'fibofilters/filter/get_data', function ( $data, $context ) { if ( $context !== 'frontend-filtering' ) { return $data; } if ( $data['url_slug'] === 'caps-size' && $data['type'] === 'range' ) { $data['number_prefix'] = '~'; $data['number_suffix'] = '"'; $data['number_precision'] = 1; } return $data; }, 10, 2 );
The result looks like that:
![Number range with sizes](https://fibofilters.com/wp-content/uploads/2023/06/number-range-with-sizes.png)
~
, suffix "
and number precision set to 1
.