Adds a reviews collection to Payload v3 that links to a configurable products collection. Reviews have a 1-5 star rating and go through pending, approved or rejected moderation. Author email is hidden from the public API, and approved ratings can feed aggregateRating JSON-LD. The database table, API route and frontend components are set up by the developer.
A Payload CMS v3 plugin to add customer reviews with moderation, star ratings, and Google rich snippets support.
Installation
npm i payload-plugin-reviews1
Stars
0
Forks
0
Open Issues
1 months ago
Last Updated
5
Weekly Downloads
v1.0.2
npm Version
13.6 KB
Unpacked Size
0
Dependencies
1+1 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 1 |
| Dec 4, 2026 | 1 |
| Dec 3, 2026 | 1 |
| Dec 2, 2026 | 1 |
| Dec 1, 2026 | 1 |
| Nov 30, 2026 | 1 |
| Nov 29, 2026 | 1 |
| Nov 28, 2026 | 1 |
| Nov 27, 2026 | 1 |
| Nov 26, 2026 | 1 |
| Nov 25, 2026 | 1 |
| Nov 24, 2026 | 1 |
| Nov 23, 2026 | 1 |
| Nov 22, 2026 | 1 |
| Nov 21, 2026 | 1 |
| Nov 20, 2026 | 1 |
| Nov 19, 2026 | 1 |
| Nov 18, 2026 | 1 |
| Nov 17, 2026 | 1 |
| Nov 16, 2026 | 1 |
| Nov 15, 2026 | 1 |
| Nov 14, 2026 | 1 |
| Nov 13, 2026 | 1 |
| Nov 12, 2026 | 1 |
| Nov 11, 2026 | 1 |
| Nov 10, 2026 | 1 |
| Nov 9, 2026 | 1 |
| Nov 8, 2026 | 1 |
| Nov 7, 2026 | 1 |
| Nov 6, 2026 | 1 |
| Nov 5, 2026 | 1 |
| Nov 4, 2026 | 1 |
| Nov 3, 2026 | 1 |
| Nov 2, 2026 | 1 |
| Nov 1, 2026 | 1 |
| Oct 31, 2026 | 1 |
| Oct 30, 2026 | 1 |
| Oct 29, 2026 | 1 |
| Oct 28, 2026 | 1 |
| Oct 27, 2026 | 1 |
| Oct 26, 2026 | 1 |
| Oct 25, 2026 | 1 |
| Oct 24, 2026 | 1 |
| Oct 23, 2026 | 1 |
| Oct 22, 2026 | 1 |
| Oct 21, 2026 | 1 |
| Oct 20, 2026 | 1 |
| Oct 19, 2026 | 1 |
| Oct 18, 2026 | 1 |
| Oct 17, 2026 | 1 |
| Oct 16, 2026 | 1 |
| Oct 15, 2026 | 1 |
| Oct 14, 2026 | 1 |
| Oct 13, 2026 | 1 |
| Oct 12, 2026 | 1 |
| Oct 11, 2026 | 0 |
| Oct 10, 2026 | 0 |
| Oct 9, 2026 | 0 |
| Oct 8, 2026 | 0 |
| Oct 7, 2026 | 0 |
| Oct 6, 2026 | 0 |
| Oct 5, 2026 | 0 |
| Oct 4, 2026 | 0 |
| Oct 3, 2026 | 0 |
| Oct 2, 2026 | 0 |
| Oct 1, 2026 | 0 |
| Sep 30, 2026 | 0 |
| Sep 29, 2026 | 0 |
| Sep 28, 2026 | 0 |
| Sep 27, 2026 | 0 |
| Sep 26, 2026 | 0 |
| Sep 25, 2026 | 0 |
| Sep 24, 2026 | 0 |
| Sep 23, 2026 | 0 |
| Sep 22, 2026 | 0 |
| Sep 21, 2026 | 0 |
| Sep 20, 2026 | 0 |
| Sep 19, 2026 | 0 |
| Sep 18, 2026 | 0 |
| Sep 17, 2026 | 0 |
| Sep 16, 2026 | 0 |
| Sep 15, 2026 | 0 |
| Sep 14, 2026 | 0 |
| Sep 13, 2026 | 0 |
| Sep 12, 2026 | 0 |
| Sep 11, 2026 | 0 |
| Sep 10, 2026 | 0 |
| Sep 9, 2026 | 0 |
| Sep 8, 2026 | 0 |
| Sep 7, 2026 | 0 |
| Sep 6, 2026 | 0 |
3−7 since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 3 |
| Dec 4, 2026 | 3 |
| Dec 3, 2026 | 3 |
| Dec 2, 2026 | 5 |
| Dec 1, 2026 | 6 |
| Nov 30, 2026 | 9 |
| Nov 29, 2026 | 9 |
| Nov 28, 2026 | 9 |
| Nov 27, 2026 | 9 |
| Nov 26, 2026 | 9 |
| Nov 25, 2026 | 7 |
| Nov 24, 2026 | 7 |
| Nov 23, 2026 | 4 |
| Nov 22, 2026 | 5 |
| Nov 21, 2026 | 6 |
| Nov 20, 2026 | 8 |
| Nov 19, 2026 | 10 |
| Nov 18, 2026 | 10 |
| Nov 17, 2026 | 9 |
| Nov 16, 2026 | 12 |
| Nov 15, 2026 | 11 |
| Nov 14, 2026 | 10 |
| Nov 13, 2026 | 8 |
| Nov 12, 2026 | 11 |
| Nov 11, 2026 | 10 |
| Nov 10, 2026 | 13 |
| Nov 9, 2026 | 10 |
| Nov 8, 2026 | 11 |
| Nov 7, 2026 | 14 |
| Nov 6, 2026 | 13 |
| Nov 5, 2026 | 9 |
| Nov 4, 2026 | 9 |
| Nov 3, 2026 | 8 |
| Nov 2, 2026 | 10 |
| Nov 1, 2026 | 9 |
| Oct 31, 2026 | 7 |
| Oct 30, 2026 | 8 |
| Oct 29, 2026 | 7 |
| Oct 28, 2026 | 7 |
| Oct 27, 2026 | 8 |
| Oct 26, 2026 | 7 |
| Oct 25, 2026 | 9 |
| Oct 24, 2026 | 12 |
| Oct 23, 2026 | 11 |
| Oct 22, 2026 | 33 |
| Oct 21, 2026 | 55 |
| Oct 20, 2026 | 340 |
| Oct 19, 2026 | 339 |
| Oct 18, 2026 | 336 |
| Oct 17, 2026 | 333 |
| Oct 16, 2026 | 333 |
| Oct 15, 2026 | 312 |
| Oct 14, 2026 | 290 |
| Oct 13, 2026 | 2 |
| Oct 12, 2026 | 2 |
| Oct 11, 2026 | 3 |
| Oct 10, 2026 | 2 |
| Oct 9, 2026 | 2 |
| Oct 8, 2026 | 1 |
| Oct 7, 2026 | 1 |
| Oct 6, 2026 | 1 |
| Oct 5, 2026 | 1 |
| Oct 4, 2026 | 0 |
| Oct 3, 2026 | 0 |
| Oct 2, 2026 | 1 |
| Oct 1, 2026 | 1 |
| Sep 30, 2026 | 1 |
| Sep 29, 2026 | 1 |
| Sep 28, 2026 | 1 |
| Sep 27, 2026 | 2 |
| Sep 26, 2026 | 5 |
| Sep 25, 2026 | 5 |
| Sep 24, 2026 | 5 |
| Sep 23, 2026 | 5 |
| Sep 22, 2026 | 6 |
| Sep 21, 2026 | 6 |
| Sep 20, 2026 | 6 |
| Sep 19, 2026 | 3 |
| Sep 18, 2026 | 3 |
| Sep 17, 2026 | 5 |
| Sep 16, 2026 | 6 |
| Sep 15, 2026 | 6 |
| Sep 14, 2026 | 9 |
| Sep 13, 2026 | 9 |
| Sep 12, 2026 | 9 |
| Sep 11, 2026 | 9 |
| Sep 10, 2026 | 7 |
| Sep 9, 2026 | 9 |
| Sep 8, 2026 | 9 |
| Sep 7, 2026 | 10 |
| Sep 6, 2026 | 10 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1270699948-root)<a href="https://payloaddirectory.dev/plugins/1270699948-root"><img src="https://payloaddirectory.dev/badge/1270699948-root.svg" alt="Payload Directory"></a>README
A Payload CMS v3 ecommerce plugin to add customer reviews with moderation, star ratings, and Google rich snippets (Schema.org) support.
⭐ If this plugin saves you time, star it on GitHub. It is the main way other Payload developers find it.
aggregateRating)npm install payload-plugin-reviews
// payload.config.ts
import { reviewsPlugin } from 'payload-plugin-reviews'
export default buildConfig({
plugins: [
reviewsPlugin({
productsCollection: 'products', // default
}),
],
})
⚠️ If Payload is running in
devmode (migration batch-1), the table won't be created automatically. Run this SQL manually:
CREATE TYPE "public"."enum_reviews_status" AS ENUM('pending', 'approved', 'rejected');
CREATE TABLE IF NOT EXISTS "reviews" (
"id" serial PRIMARY KEY,
"product_id" integer NOT NULL REFERENCES "products"("id") ON DELETE SET NULL,
"author_name" varchar NOT NULL,
"author_email" varchar NOT NULL,
"rating" numeric NOT NULL,
"title" varchar,
"comment" varchar NOT NULL,
"verified" boolean DEFAULT false,
"status" "enum_reviews_status" DEFAULT 'pending',
"updated_at" timestamp(3) with time zone NOT NULL DEFAULT now(),
"created_at" timestamp(3) with time zone NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS "reviews_created_at_idx" ON "reviews" USING btree ("created_at");
ALTER TABLE "payload_locked_documents_rels"
ADD COLUMN IF NOT EXISTS "reviews_id" integer REFERENCES "reviews"("id") ON DELETE CASCADE;
CREATE INDEX IF NOT EXISTS "payload_locked_documents_rels_reviews_id_idx"
ON "payload_locked_documents_rels" USING btree ("reviews_id");
Create src/app/(app)/api/reviews/product/[productId]/route.ts:
import configPromise from '@payload-config'
import { getPayload } from 'payload'
import { NextRequest } from 'next/server'
export async function GET(
req: NextRequest,
{ params }: { params: Promise<{ productId: string }> }
) {
const { productId } = await params
const payload = await getPayload({ config: configPromise })
const reviews = await payload.find({
collection: 'reviews',
where: {
and: [
{ product: { equals: parseInt(productId, 10) } },
{ status: { equals: 'approved' } },
],
},
sort: '-createdAt',
limit: 50,
})
const avg =
reviews.docs.length > 0
? reviews.docs.reduce((acc, r) => acc + (r.rating as number), 0) / reviews.docs.length
: 0
return Response.json({
docs: reviews.docs,
totalDocs: reviews.totalDocs,
averageRating: Math.round(avg * 10) / 10,
})
}
Copy the following components to your project:
StarRating.tsx — star display and interactive pickerReviewForm.tsx — public review submission formReviewsList.tsx — reviews list with average, distribution bars, and form toggleSee the /examples folder for full source.
import { ReviewsList } from '@/components/ReviewsList'
// In your product page component:
<ReviewsList productId={`${product.id}`} />
In your product page, fetch reviews server-side and include aggregateRating in your JSON-LD:
const reviewsData = await payload.find({
collection: 'reviews',
where: {
and: [
{ product: { equals: product.id } },
{ status: { equals: 'approved' } },
],
},
pagination: false,
})
const avg = reviewsData.docs.length > 0
? reviewsData.docs.reduce((a, b) => a + (b.rating as number), 0) / reviewsData.docs.length
: 0
const productJsonLd = {
'@context': 'https://schema.org',
'@type': 'Product',
name: product.title,
...(reviewsData.docs.length > 0 ? {
aggregateRating: {
'@type': 'AggregateRating',
ratingValue: Math.round(avg * 10) / 10,
reviewCount: reviewsData.docs.length,
bestRating: 5,
worstRating: 1,
}
} : {}),
offers: {
'@type': 'AggregateOffer',
price: product.price / 100, // prices stored in cents
priceCurrency: 'EUR',
},
}
Test your rich snippets: Google Rich Results Test This article summarizes the functions on: dev.to
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Enable or disable the plugin |
productsCollection | string | 'products' | Slug of your products collection |
adminEmail | string | undefined | Email to notify on new review (requires email adapter) |
parseInt(productId, 10) is required when submitting reviews — Payload rejects string IDs for relationship fields.verified is always reset to false on creation — only admins can mark a review as verified purchase.3990 = €39.90), divide by 100 in JSON-LD and frontend display.I'm Camille Guerineau. I spent ten years as a jewelry maker and founder of Loch Ness Paris before going back to full-stack development. I build Payload CMS shops for real e-commerce, and I publish the pieces that were missing.
payload-plugin-seo-jsonld, Schema.org JSON-LD for Product, BreadcrumbList, ItemList, WebSite and Organizationverumano)Need help with a Payload CMS v3 shop, SEO or rich snippets? Get in touch through lochness-paris.com.
MIT © Camille Guerineau
payload reviews
Product reviews for Payload ecommerce with verified purchase flags, moderation and exact aggregate ratings
7317/wk2v3
Payload LFRs
Likes, dislikes, favourites, ratings, reviews, replies and sharing for Payload collections with React components
5269/wk9v3
ecommerce
Ecommerce utilities for Payload with idempotent Stripe confirmation, orders, carts and inventory handling
10019.0k/wk46.1kv3 v4
payload stock reservation
Validates variant stock and price at checkout and holds stock until payment settles or the hold expires
76152/wk1v3
payload coupons
Coupon codes with percentage and fixed discounts for Payload ecommerce, calculated in integer minor units
76144/wk2v3
payload plugin restock
Supplier lists, purchase orders and receiving drafted from stock levels, with copy-ready orders for suppliers without…
75232/wk0v3