🔍 Filtering Reviews
This guide explains how to filter reviews using various parameters available in the Alphabite Reviews Plugin. Filtering allows you to retrieve a specific subset of reviews based on your criteria.
✅ Prerequisites
- A Medusa backend with the Reviews plugin installed and configured.
- Existing reviews in your system.
🔨 Step-by-Step Implementation
The list and listProductReviews endpoints support several filtering parameters:
- product_ids: Filter reviews by one or more product IDs (only for- listendpoint).
- my_reviews_only: Show only reviews created by the current authenticated customer.
- verified_purchase_only: Show only reviews from customers who have a verified purchase of the product.
- rating: Filter reviews by a specific star rating (1-5).
- sort: Sort reviews by- created_ator- rating(only for- listProductReviewsendpoint).
- order: Sort order (- ascor- desc).
1. Filter by Product IDs (List All Reviews)
To get reviews for specific products:
- Using SDK
- Using REST (Medusa SDK or fetch)
const reviewsList = await sdk.alphabite.reviews.list({
  product_ids: ["prod_123", "prod_456"],
});
import { ListReviewsInput, ListReviewsOutput } from "@alphabite/medusa-sdk";
const reviewsList = await sdk.client.fetch<ListReviewsOutput>("/store/products/reviews", {
  method: "GET",
  query: {
    product_ids: ["prod_123", "prod_456"],
  } as ListReviewsInput,
});
2. Filter by Verified Purchase and Rating (Product Reviews)
To get only verified purchase reviews with a specific rating for a product:
- Using SDK
- Using REST (Medusa SDK or fetch)
const { reviews } = await sdk.alphabite.reviews.listProductReviews({
  product_id: "prod_...",
  verified_purchase_only: true,
  rating: 5,
});
import { ListProductReviewsInput, ListProductReviewsOutput } from "@alphabite/medusa-sdk";
const { reviews } = await sdk.client.fetch<ListProductReviewsOutput>(`/store/reviews/product/prod_...`, {
  method: "GET",
  query: {
    verified_purchase_only: true,
    rating: 5,
  } as ListProductReviewsInput,
});
console.log("Verified 5-star reviews for product:", reviews);
3. Filter by My Reviews Only
To retrieve reviews submitted by the currently authenticated customer:
- Using SDK
- Using REST (Medusa SDK or fetch)
const { reviews } = await sdk.alphabite.reviews.list({
  my_reviews_only: true,
});
console.log("My reviews:", reviews);
import { ListReviewsInput, ListReviewsOutput } from "@alphabite/medusa-sdk";
const { reviews } = await sdk.client.fetch<ListReviewsOutput>("/store/products/reviews", {
  method: "GET",
  query: {
    my_reviews_only: true,
  } as ListReviewsInput,
});
console.log("My reviews:", reviews);
API Reference
Learn more about our Medusa SDK Wrapper Alphabite Medusa SDK Wrapper 🔗
You can view the full endpoint documentation for:
📝 Notes
- Combine filters to narrow down your search results.
- Ensure proper authentication for my_reviews_onlyandverified_purchase_onlyfilters to work correctly.
🔗 Related
- Docs: Alphabite Medusa SDK Wrapper
- Docs: List Reviews - GET /store/products/reviews
- Docs: List Product Reviews - GET /store/reviews/product/:product_id