Filter Products using Query
In this guide, you'll learn about the different ways you can filter products in the Medusa server using Query.
Filter Products by Field Values#
You can filter products based on specific field values by passing them to Query's filters parameter.
For example, to filter products by their IDs:
Filter Products by Options#
You can filter products based on whether any of their variants have specific options, such as size or color.
For example:
In this example, only products that have at least one variant with either the opt_123 or opt_456 option will be returned.
Filter Products by Option Values#
You can filter products based on whether any of their variants have specific option values, such as "Red" or "Large".
For example:
In this example, only products that have at least one variant with either the optval_123 or optval_456 option value will be returned.
Filter Products by Category#
You can filter products based on the categories they belong to.
For example:
In this example, only products that belong to either the cat_123 or cat_456 category will be returned.