@tsc_tech/medusa-plugin-product-filter
v0.0.6
Published
A starter for Medusa plugins.
Maintainers
Readme
🛍️ 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-filterUsing yarn
yarn add @tsc_tech/medusa-plugin-product-filterAfter installation, make sure to configure your medusa-config.js:
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: GET /store/filter/products
Headers:
Content-Type: application/json
x-publishable-api-key: <your-publishable-key>Query Parameters:
option_value[]: Filter by product option valueslimit(number): Number of products per pagemin_price(number): Minimum price filtermax_price(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: GET /store/filter/products/price-range
Headers:
x-publishable-api-key: <your-publishable-key>Query Parameters:
categoryId: 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: GET /store/category/filter/:categoryHandle
Headers:
x-publishable-api-key: <your-publishable-key>Parameters:
categoryHandle: 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
<your-publishable-key>with your Medusa instance publishable key - Replace
<category-handle>with your actual category handle - Replace
<category-id>with your actual category ID
4. 🎨 Get Filtered Product Variants
Retrieve product variants based on specified filters.
Endpoint: GET /store/filter/product-variants
Headers:
x-publishable-api-key: <your-publishable-key>Query Parameters:
region_id: ID of the regionoption_value[]: Filter by variant option valuesmin_price(number): Minimum price filtermax_price(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
<your-publishable-key>with your Medusa instance publishable key - Replace
<region-id>with your actual region ID - Replace
<category-handle>with your actual category handle - Replace
<category-id>with your actual category ID
🆘 Support
If you encounter any issues or need additional help:
- 💬 Join the Medusa Discord community
- 📚 Check the Medusa Documentation
