Filter Products using Query

In this guide, you'll learn about the different ways you can filter products in the Medusa server using Query.

Looking for Storefront Guide? Refer to the Product Filtering in Storefront guide to learn how to implement product filtering in your storefront.

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#

Note: This feature is available since Medusa v2.16.0.

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#

Note: This feature is available since Medusa v2.16.0.

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.

Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break
⇧↵