Product reviews
Product Reviews Plugin for Medusa
@lambdacurry/medusa-product-reviews
A plugin that adds product review and moderation capabilities to your Medusa application, with built-in admin responses and review statistics.
This plugin is part of the Medusa Plugins Collection.
Features
See a demo in our Medusa Starter
- Product reviews with ratings
- Review statistics and analytics
- Review moderation workflow (//)
- Admin response management
- SDK for Store and Admin operations
Prerequisites
Installation and Configuration
- Install the plugin:
yarn add @lambdacurry/medusa-product-reviews# or, if you're using yarn workspacesyarn workspace my-app add @lambdacurry/medusa-product-reviews
- Add to :
module.exports = defineConfig({plugins: [{resolve: '@lambdacurry/medusa-product-reviews',options: {defaultReviewStatus: 'pending', // OPTIONAL, default is 'approved'},},],});
- Run migrations:
yarn medusa db:migrate
Using the Plugin SDK
For detailed SDK setup and configuration, refer to the @lambdacurry/medusa-plugins-sdk README.
Store Operations
// List product reviewsconst { reviews, count } = await sdk.store.productReviews.list(query: StoreListProductReviewsQuery,headers?: ClientHeaders);// Create/Update a reviewconst review = await sdk.store.productReviews.upsert(data: StoreUpsertProductReviewsDTO,headers?: ClientHeaders);// Get review statisticsconst stats = await sdk.store.productReviews.listStats(query: StoreListProductReviewStatsQuery,headers?: ClientHeaders);
Admin Operations
// List reviewsconst { reviews, count } = await sdk.admin.productReviews.list(query: AdminListProductReviewsQuery);// Update review statusconst review = await sdk.admin.productReviews.updateStatus(productReviewId: string,status: 'pending' | 'approved' | 'flagged');// Manage review responsesconst review = await sdk.admin.productReviews.createResponse(productReviewId: string,data: AdminCreateProductReviewResponseDTO);await sdk.admin.productReviews.updateResponse(productReviewId: string,data: AdminUpdateProductReviewResponseDTO);await sdk.admin.productReviews.deleteResponse(productReviewId: string);
Review Workflow
-
Creation: Reviews are set to:
- status by default
- status if is set in plugin options
-
Moderation: Admins can:
- List and filter reviews
- Update review status (approve/flag)
- Manage responses (create/update/delete)
Available Endpoints
Admin Endpoints
- - List all reviews
- - Add a response
- - Update response
- - Delete response
- - Update status
Store Endpoints
- - List reviews
- - Create/Update review
- - Get statistics
Local Development
IMPORTANT: A running PostgreSQL instance is required. The plugin expects and environment variables to be set. If not provided, both default to "postgres".
Available scripts:
# Build the pluginyarn build# Development mode with hot-reloadyarn dev# Publish to local registry for testingyarn dev:publish# Generate database migrationsyarn db:generate
Installing the plugin in your Medusa project for local development
After publishing the plugin locally by running yarn dev:publish, go to the root of your Medusa project and run the following commands:
cd path/to/your/medusa-applicationyarn medusa plugin:add @lambdacurry/medusa-product-reviews# If you are yarn with a monorepo, you may also need to runyarn install
Compatibility
This plugin is compatible with versions of .
License
MIT License