Submit Review
Allow customers to submit product reviews.
Updated
On this page
Overview
Allow customers to submit reviews for products they have purchased.
SDK Usage
import dash from "@/lib/dash"
const { review } = await dash.products.submitReview("blue-dream", {
rating: 5, // 1-5, required
author_name: "John D.", // required
author_email: "john@example.com", // optional
title: "Amazing quality", // optional
body: "Best product I've tried!", // optional
variation_slug: "blue-dream", // optional: which variation was reviewed
media_urls: ["https://..."], // optional: photo URLs
})
Review Form Example
"use client"
import { useState } from "react"
import dash from "@/lib/dash"
export function ReviewForm({ productSlug }: { productSlug: string }) {
const [rating, setRating] = useState(5)
const [title, setTitle] = useState("")
const [body, setBody] = useState("")
const [name, setName] = useState("")
const [submitted, setSubmitted] = useState(false)
async function handleSubmit(e) {
e.preventDefault()
await dash.products.submitReview(productSlug, {
rating,
author_name: name,
title,
body,
})
setSubmitted(true)
}
if (submitted) return <p>Thank you for your review!</p>
return (
<form onSubmit={handleSubmit}>
<div>
{[1, 2, 3, 4, 5].map(star => (
<button key={star} type="button" onClick={() => setRating(star)}>
{star <= rating ? "★" : "☆"}
</button>
))}
</div>
<input value={name} onChange={e => setName(e.target.value)}
placeholder="Your name" required />
<input value={title} onChange={e => setTitle(e.target.value)}
placeholder="Review title" />
<textarea value={body} onChange={e => setBody(e.target.value)}
placeholder="Write your review..." />
<button type="submit">Submit Review</button>
</form>
)
}
Moderation: Reviews are held for approval by default. They won't appear publicly until approved in the dashboard.
REST API
POST /storefront/products/blue-dream/reviews
X-API-Key: pk_live_your_key
Content-Type: application/json
{
"rating": 5,
"author_name": "John D.",
"title": "Amazing quality",
"body": "Best product I've tried!"
}
Next Steps
- Get Product Reviews — Displaying reviews
- Get Product by Slug — Full product page with reviews