Skip to content

Update Product Review

About

The updateProductReview mutation allows updating existing product reviews. Use this mutation to:

  • Update review title and comment
  • Change review rating
  • Modify reviewer information
  • Update review status (pending, approved, rejected)
  • Correct review mistakes
  • Approve or reject pending reviews
  • Track review updates with client mutation ID

This mutation requires the review ID in IRI format and returns the updated review with current timestamps.

Arguments

ArgumentTypeRequiredDescription
idID!✅ YesReview ID in IRI format (e.g., /api/shop/reviews/1). Required for identifying which review to update.
productIdInt❌ NoThe ID of the product being reviewed.
titleString❌ NoReview title/headline.
commentString❌ NoReview comment/text.
ratingInt❌ NoStar rating (1-5).
nameString❌ NoReviewer's name.
statusInt❌ NoReview status (0 = pending, 1 = approved, 2 = rejected).
clientMutationIdString❌ NoOptional client mutation tracking ID.

Input Fields Details

id

  • Type: ID (IRI Format)
  • Required: Yes
  • Format: /api/shop/reviews/{id} or /api/shop/reviews/{id}
  • Description: Unique identifier for the review being updated.
  • Example: /api/shop/reviews/1
  • Note: Only IRI format is supported for review updates; numeric IDs are not accepted.

productId

  • Type: Integer
  • Required: No
  • Description: The product ID associated with this review.
  • Example: 357
  • Note: Typically not changed during review update.

title

  • Type: String
  • Required: No
  • Description: Review headline. Leave empty to keep current value.
  • Example: "Excellent quality and very stylish"

comment

  • Type: String
  • Required: No
  • Description: Full review text with detailed feedback. Leave empty to keep current value.
  • Example: "Very impressed with the product..."

rating

  • Type: Integer (1-5)
  • Required: No
  • Description: Star rating. Leave empty to keep current value.
  • Valid Values: 1, 2, 3, 4, 5

name

  • Type: String
  • Required: No
  • Description: Reviewer's name as displayed on review.
  • Example: "John Doe"

status

  • Type: Integer
  • Required: No
  • Valid Values:
    • 0 - Pending approval
    • 1 - Approved and visible
    • 2 - Rejected/hidden
  • Description: Current review status.
  • Example: 1

clientMutationId

  • Type: String
  • Required: No
  • Description: Optional tracking ID for this mutation request.
  • Example: "demo-review-update-001"

Possible Returns

FieldTypeDescription
productReviewProductReview!The updated product review object.
productReview.idID!Unique review API identifier.
productReview._idInt!Numeric review ID.
productReview.nameString!Reviewer's name.
productReview.titleString!Review title.
productReview.ratingInt!Star rating (1-5).
productReview.commentString!Review text.
productReview.statusInt!Review status.
clientMutationIdStringEchoed client mutation ID for tracking.

Review Status

StatusDescriptionUsage
0PendingAwaiting admin approval before display
1ApprovedPublished on product page
2RejectedHidden from public view

ID Format Requirements

Valid ID Format (IRI)

/api/shop/reviews/1
/api/shop/reviews/92

Invalid Formats (Not Supported)

93                    ❌ Numeric ID only
reviews/93            ❌ Partial path
/reviews/93           ❌ Incorrect path

Update Behavior

  • Partial Updates: You can update only specific fields; omitted fields keep their current values
  • Required ID: The review ID must always be provided in IRI format
  • Status Changes: Can change review status from any state to any other state

Use Cases

1. Approve Pending Review

Use the "Change Status" example to approve a pending review for display on product page.

2. Correct Review Mistake

Use the "Basic" example to fix typos or clarifications in review text.

3. Update Review Rating

Update the rating if customer changed their assessment after further use.

4. Reject Inappropriate Review

Change status to 2 (rejected) to hide inappropriate content.

5. Complete Admin Review Update

Use the "Complete" example for comprehensive review updates by admin staff.

Best Practices

  1. Always Use IRI Format - Always provide review ID in IRI format (/api/shop/reviews/{id})
  2. Validate Before Update - Fetch current review data before making changes
  3. Track Changes - Use clientMutationId for audit trail and tracking
  4. Partial Updates - Update only necessary fields to preserve existing data
  5. Status Management - Only approve genuine, quality reviews
  6. Audit Trail - Log who made changes and when using timestamps
  7. Moderation - Review text for appropriate content before approval
  8. Notify Users - Consider notifying customers when review status changes

Common Update Scenarios

Approve Review from Pending

Set status: 1 to make pending review visible to customers.

Reject Inappropriate Review

Set status: 2 to hide review with offensive content.

Update Customer Feedback

Modify comment field if customer requests clarification or updates.

Correct Reviewer Name

Update name field if incorrect information was initially submitted.

Change Rating

Modify rating if customer reassesses product after extended use.

Error Scenarios

Missing ID

When id is not provided, mutation fails with validation error.

Invalid ID Format

When ID is provided in numeric format instead of IRI format.

Review Not Found

When provided ID doesn't correspond to existing review.

Invalid Status Value

When status is outside the valid range (0, 1, 2).

Invalid Rating Value

When rating is outside the valid range (1-5).

Released under the MIT License.