Medusa plugins
P

Product filter

A starter for Medusa plugins.

Need customizations for this plugin?

Get in touch
npm install @tsc_tech/medusa-plugin-product-filter
Category
other
Built by
tsc_tech
Type
unknown
Last updated
5 months ago
Monthly downloads
79

đŸ›ī¸ Medusa Product Filter Plugin

🔧 Compatibility

  • Node.js: >= 20
  • Medusa: v2.4.0
  • @medusajs/admin-sdk: 2.4.0
  • @medusajs/framework: 2.4.0
  • @medusajs/ui: 4.0.4

đŸ“Ĩ Installation

Using npm

npm install @tsc_tech/medusa-plugin-product-filter

Using yarn

yarn add @tsc_tech/medusa-plugin-product-filter

After installation, make sure to configure your :

module.exports = {
plugins: [
// ... other plugins
{
resolve: `@tsc_tech/medusa-plugin-product-filter`,
options: {}
},
],
}

đŸŽ¯ Product Filter API

1. đŸ“Ļ Get Filtered Products

Retrieve products based on specified filters.

Endpoint:

Headers:

Content-Type: application/json
x-publishable-api-key: <your-publishable-key>

Query Parameters:

  • : Filter by product option values
  • (number): Number of products per page
  • (number): Minimum price filter
  • (number): Maximum price filter

Example Request:

curl --location --globoff 'http://localhost:9000/store/filter/products?option_value[]=[%22option1%22%2C%22option2%22]&limit=10&min_price=0&max_price=50' \
--header 'Content-Type: application/json' \
--header 'x-publishable-api-key: <your-publishable-key>'

2. 💰 Get Price Range

Retrieve the price range for products in a specific category.

Endpoint:

Headers:

x-publishable-api-key: <your-publishable-key>

Query Parameters:

  • : ID of the category to get price range for

Example Request:

curl --location 'http://localhost:9000/store/filter/products/price-range/?categoryId=<category-id>' \
--header 'x-publishable-api-key: <your-publishable-key>'

Example Response:

{
"max": "100",
"min": "10"
}

3. 🔍 Get Category Filter Options

Retrieve all available option values for a specific category.

Endpoint:

Headers:

x-publishable-api-key: <your-publishable-key>

Parameters:

  • : The handle of the category (URL parameter)

Example Request:

curl --location 'http://localhost:9000/store/category/filter/<category-handle>' \
--header 'x-publishable-api-key: <your-publishable-key>'

Example Response:

[
{
"title": "color",
"values": [
"red",
"green",
"blue",
"black"
]
}
]

The response provides an array of option types and their available values in the specified category.

Note:

  • Replace with your Medusa instance publishable key
  • Replace with your actual category handle
  • Replace with your actual category ID

4. 🎨 Get Filtered Product Variants

Retrieve product variants based on specified filters.

Endpoint:

Headers:

x-publishable-api-key: <your-publishable-key>

Query Parameters:

  • : ID of the region
  • : Filter by variant option values
  • (number): Minimum price filter
  • (number): Maximum price filter

Example Request:

curl --location --globoff 'http://localhost:9000/store/filter/product-variants?region_id=<region-id>&option_value[]=[%22option1%22%2C%22option2%22]&min_price=10&max_price=50' \
--header 'x-publishable-api-key: <your-publishable-key>'

Note: â„šī¸

  • Replace with your Medusa instance publishable key
  • Replace with your actual region ID
  • Replace with your actual category handle
  • Replace with your actual category ID

🆘 Support

If you encounter any issues or need additional help: