Search.../

updateReview( )

Developer Preview

Updates a review.

Description

The updateReview() function returns a promise that resolves to the updated review.

Each time the review is updated, revision increments by 1. The existing revision must be included when updating the review. This ensures you're working with the latest review information, and it prevents unintended overwrites.

This function is not a universal function and runs only on the backend.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function updateReview(_id: string, review: UpdateReview): Promise<Review>

updateReview Parameters

NAME
TYPE
DESCRIPTION
_id
string

Review ID.

review
UpdateReview

Review to update.

Returns

Updated review data.

Return Type:

Promise<
Review
>
NAME
TYPE
DESCRIPTION
_createdDate
Date

Date and time the review was created.

_id
string

Review ID.

_updatedDate
Date

Date and time the review was updated.

author
Author

Author of the review.

content
ReviewContent

Review content.

entityId
string

ID of the entity to review. For example, a Wix Stores product ID.

foundHelpful
number

Number of site visitors who found the review helpful.

foundUnhelpful
number

Number of site visitors who found the review unhelpful.

helpfulness
number

Helpfulness score.

Calculated by subtracting foundUnhelpful from foundHelpful.

moderation
Moderation

Moderation status of the review.

namespace
string

Review namespace. Currently integrated with Wix Stores, as stores.

origin
Origin

Provides information about the origin of the review. Organic reviews are created by site visitors or members. App reviews are created by apps even though a site visitor or member is the author of the review. Apps can not create or update organic reviews.

reply
Reply

Reply to the review.

reviewDate
Date

Date and time then review was written. It should the same time as created_date except for reviews that were imported from the other review system.

revision
string

Revision number, which increments by 1 each time the review is updated. To prevent conflicting changes, the current revision must be passed when updating the review. Ignored when creating a review.

verified
boolean

Indicates whether the review has been verified through a Verify Product Purchase call to the Review Product catalog SPI.

Was this helpful?

updateReview example

Copy Code
1import { reviews } from 'wix-reviews.v2';
2
3 async function updateReview(id, review, options) {
4 try {
5 const result = await reviews.updateReview(id, review, options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13