RatingsClient#listRatingsByProductId(productId, options);
Ratings allow users to give an indication of their satisfaction or the quality of a product. A rating summary is displayed on the top of the product detail page (PDP), while the rating breakdown and paginated list of ratings & reviews are at the bottom of the PDP. By default, only authenticated/logged-in users are allowed to leave ratings on PDPs.
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
The product id to retrieve rating details for |
|
❌ |
Options passed to the HTTP request call to customize the pagination request configuration. |
This function returns a Page of Rating Details.
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
The product id to retrieve rating details for |
|
|
✅ |
The variant id of the product |
|
❌ |
Options passed to the HTTP request call to customize the pagination request configuration. |
This function returns a Page of Rating Details.
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
The rating detail ID to fetch |
|
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a Rating Detail.
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
The customer id to retrieve rating details for |
|
❌ |
Options passed to the HTTP request call to customize the pagination request configuration. |
This function returns a Page of Rating Details.
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
The product id to submit a rating for |
|
✅ |
The rating information to be submitted and saved |
|
|
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a Rating Detail.
const ratingDetail: RatingDetail = await ratingsClient.submitProductRating(productId, {
rating: 4,
customerId: "customer1",
customerName: "Customer 1",
reviewTitle: "Okay",
review: "It was okay",
ratingTargetId: "product1"
});
console.log(ratingDetail);
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
The product id to submit a rating for |
|
|
✅ |
The variant id to submit a rating for |
|
✅ |
The rating information to be submitted and saved |
|
|
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a Rating Detail.
const ratingDetail: RatingDetail = await ratingsClient.submitVariantRating(productId, variantId, {
rating: 4,
customerId: "customer1",
customerName: "Customer 1",
reviewTitle: "Okay",
review: "It was okay",
ratingTargetId: "variant1"
});
console.log(ratingDetail);
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
The customer id of the author of the rating detail to update |
|
|
✅ |
The detail id of the rating detail to update |
|
✅ |
The rating information to be updated and saved |
|
|
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a Rating Detail.
const ratingDetail: RatingDetail = await ratingsClient.updateCustomerRating(customerId, detailId, {
rating: 2,
customerId: "customer1",
customerName: "Customer 1",
reviewTitle: "Changed my mind, it's bad",
review: "x(",
ratingTargetId: "variant1"
});
console.log(ratingDetail);
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
The product id to retrieve the rating summary for |
|
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a Rating Summary.
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
The product id to retrieve the rating summary for |
|
|
✅ |
The variant id to retrieve the rating summary for |
|
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a Rating Summary.
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
The target ids for the rating summaries to fetch |
|
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a list of Rating Summaries.
Parameter | Type | Required? | Description |
---|---|---|---|
|
|
✅ |
The id of the product to retrieve the rating counts and percentages for |
|
|
❌ |
Options passed to the HTTP request call to customize the request configuration. |
This function returns a list of Rating Counts and Percentages.