Skip to main content

🔍 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 list endpoint).
  • 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_at or rating (only for listProductReviews endpoint).
  • order: Sort order (asc or desc).

1. Filter by Product IDs (List All Reviews)

To get reviews for specific products:

const reviewsList = await sdk.alphabite.reviews.list({
product_ids: ["prod_123", "prod_456"],
});

2. Filter by Verified Purchase and Rating (Product Reviews)

To get only verified purchase reviews with a specific rating for a product:

const { reviews } = await sdk.alphabite.reviews.listProductReviews({
product_id: "prod_...",
verified_purchase_only: true,
rating: 5,
});

3. Filter by My Reviews Only

To retrieve reviews submitted by the currently authenticated customer:

const { reviews } = await sdk.alphabite.reviews.list({
my_reviews_only: true,
});
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_only and verified_purchase_only filters to work correctly.