Medusa plugins
P
Product filter
A starter for Medusa plugins.
đī¸ 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/jsonx-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:
- đŦ Join the Medusa Discord community
- đ Check the Medusa Documentation