Using a range to search numeric fields

GravityView Version 2.22 supports the use of numeric ranges to search within Number, Product (user-defined price), Quantity, and Total fields. This allows for more precise filtering by enabling users to search for entries with field values that fall within specific numerical boundaries.

For example, users can search for:

  • Products priced between $10 and $20, or
  • Students who scored between 80 and 100 percent on their tests.

Watch the video demo

To configure range search, follow these steps:

  1. Add a Search Bar widget to your View
  2. Open the widget's settings and select one of the supported field types from the list: Number, Product, Quantity, or Total
  3. Set the "Input Type" to "Number range"
  4. Save and then open your View

Your Search Bar will now contain two input fields ("From" and "To") for each of the selected fields, allowing users to specify a minimum and maximum range for their search criteria. These inputs support decimals and, by default, increment by 1 when adjusted using the keyboard or mouse.

Customizing the number step increment

If you wish to customize the number step increment (for example, to allow incremets of 0.5), you can use the gk/gravityview/search/number-range/step filter:

add_filter( 'gk/gravityview/search/number-range/step', function () {
  return '0.5';
} );
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us