📝 Listing Product Reviews
This guide explains how to list product reviews using the Alphabite Reviews Plugin. You can list all reviews or reviews for a specific product.
✅ Prerequisites
- A Medusa backend with the Reviews plugin installed and configured.
- Existing reviews in your system.
🔨 Step-by-Step Implementation
1. List All Reviews
To retrieve a list of all reviews, use the list
endpoint.
- Using SDK
- Using REST (Medusa SDK or fetch)
const { reviews, count, limit, offset } = await sdk.alphabite.reviews.list({
limit: 10,
offset: 0,
// Add filters as needed, e.g., product_ids: ["prod_123"]
});
console.log(reviews);
import { ListReviewsInput, ListReviewsOutput } from "@alphabite/medusa-sdk";
const { reviews, count, limit, offset } = await sdk.client.fetch<ListReviewsOutput>("/store/products/reviews", {
method: "GET",
query: {
limit: 10,
offset: 0,
// Add filters as needed
} as ListReviewsInput,
});
console.log(reviews);
2. List Reviews for a Specific Product
To retrieve reviews for a particular product, use the listProductReviews
endpoint.
- Using SDK
- Using REST (Medusa SDK or fetch)
const { reviews, count, limit, offset } = await sdk.alphabite.reviews.listProductReviews({
product_id: "prod_...",
limit: 10,
offset: 0,
// Add filters as needed, e.g., rating: 5
});
console.log(reviews);
import { ListProductReviewsInput, ListProductReviewsOutput } from "@alphabite/medusa-sdk";
const { reviews, count, limit, offset } = await sdk.client.fetch<ListProductReviewsOutput>(
`/store/reviews/product/prod_...`,
{
method: "GET",
query: {
limit: 10,
offset: 0,
// Add filters as needed
} as ListProductReviewsInput,
}
);
console.log(reviews);
API Reference
Learn more about our Medusa SDK Wrapper Alphabite Medusa SDK Wrapper 🔗
You can view the full endpoint documentation for:
📝 Notes
- Both
list
andlistProductReviews
endpoints support pagination and various filtering options. - You can include product details in the response by setting
include_product: true
.
🔗 Related
- Docs: Alphabite Medusa SDK Wrapper
- Docs: List Reviews - GET /store/products/reviews
- Docs: List Product Reviews - GET /store/reviews/product/:product_id