Medusa plugins
P
Plugin product reviews
Product Reviews Plugin for Medusa
Features
- Product review management
- Review submission and moderation
- Integration with Medusa admin dashboard
- Customizable review settings
- Review workflow management
- Review response system
- Review statistics and analytics
- Image attachments for reviews
- Rating system (1-5 stars)
- Review status management (pending, approved, flagged)
Technical Overview
Data Models
The plugin implements three main data models:
-
Product Review
- Basic review information (name, email, rating, content)
- Product and order associations
- Image attachments
- Review status (pending/approved/flagged)
- Order line item reference
-
Product Review Response
- Store owner responses to reviews
- Response content and metadata
-
Product Review Stats
- Aggregated statistics for products
- Review counts
- Average ratings
- Rating distribution (1-5 stars)
Core Functionality
-
Review Management
- Create, update, and delete reviews
- Moderate review status
- Attach images to reviews
- Respond to customer reviews
-
Statistics and Analytics
- Automatic calculation of product review statistics
- Rating distribution tracking
- Average rating computation
- Review count tracking
-
Configuration Options
- Default review status (pending/approved/flagged)
- Customizable review workflow
- Integration with Medusa's admin interface
Database Features
- Optimized indexes for product and order lookups
- Efficient statistics calculation using SQL aggregation
- Support for review search functionality
- Relationship management between reviews and products
Prerequisites
- Node.js >= 20
- Medusa v2.4.0 or higher
- PostgreSQL database
Installation
- Install the plugin:
npm install @devx-commerce/product-reviews# oryarn add @devx-commerce/product-reviews
- Add the plugin to your :
const plugins = [// ... other plugins{resolve: "@devx-commerce/product-reviews",options: {defaultReviewStatus: "approved", // or "pending" or "flagged"},},];
API Endpoints
Admin API
Product Reviews
- - List all product reviews
- Query parameters:
- : Fields to include in response
- : Filter criteria
- : Number of items per page
- : Page offset
- Query parameters:
Product Review Stats
- - List all product review statistics
- Query parameters:
- : Fields to include in response
- : Filter criteria
- : Number of items per page
- : Page offset
- Query parameters:
Store API
Product Reviews
- - List all product reviews
- Query parameters:
- : Fields to include in response
- : Filter criteria
- : Number of items per page
- : Page offset
- Query parameters:
- - Create or update product reviews
- Request body:
{reviews: Array<{id?: string;name?: string;email?: string;rating: number;content?: string;order_line_item_id?: string;product_id?: string;order_id?: string;images?: string[];}>;}
- Request body:
Product Review Stats
- - List all product review statistics
- Query parameters:
- : Fields to include in response
- : Filter criteria
- : Number of items per page
- : Page offset
- Query parameters:
Response Format
All list endpoints return data in the following format:
{data: T[], // Array of itemscount: number, // Total count of itemsoffset: number, // Current page offsetlimit: number // Items per page}
License
MIT