Skip to main content

Reviews Enhancement

Goal​

Extend WooCommerce's own product reviews rather than replace them. A review remains a WordPress comment; this module attaches structured extras to it — pros and cons, sub-ratings, a recommend flag, photos and videos, helpful votes and a shop reply — and shows a rating summary above the review list.

Tier and entitlement​

FieldValue
TierFree core
Entitlement keyreviews
Admin tabreviews
Module keyreviews
Settings prefixaiowc_rev_

This is one of the two modules in this group that ship in the free tier; the rest are premium. Hooks still register only when aiowc_module_enabled_reviews is true.

What the code does​

  • Extra fields added to the WooCommerce review form and saved on comment_post against the comment.
  • A rating summary rendered above the product's review list.
  • A verified-purchase badge injected into the review text through the comment_text filter.
  • Review media and helpful-vote buttons rendered after each review's text.
  • Helpful votes recorded per review, and an endpoint returning the most helpful reviews for a product.
  • A shop reply stored against the review, with its own timestamp.
  • Media moderation: uploads are held for approval unless auto_approve_media is on, and the shop can list, approve or delete them.
  • When a review comment is deleted, the module's own rows for it are removed (delete_comment).

Structured fields stored per review​

pros, cons, quality_rating, value_rating, features_rating and recommended.

Media upload handling​

Uploads go to the WordPress media handling in wp_handle_upload(). The type check is done on the bytes on disk with wp_check_filetype_and_ext() rather than on the client-supplied Content-Type, and only image/jpeg, image/png, image/gif, image/webp and video/mp4 are accepted. The verified type is what is passed on to WordPress.

Settings​

Individual options, each prefixed aiowc_rev_, registered in the aiowc_reviews group on admin_init. Defaults come from ReviewsModule::getDefaultSettings().

Option (aiowc_rev_ + key)DefaultMeaning
enable_pros_construeOffer the pros and cons fields
enable_sub_ratingstrueOffer quality, value and features ratings
enable_recommendationstrueOffer the "would recommend" flag
enable_votingtrueOffer helpful votes
enable_photostrueAccept photo uploads
enable_videosfalseAccept video uploads
auto_approve_mediafalsePublish uploaded media without moderation
max_photos5Photos allowed per review
enable_reminderstrueSend review reminder emails
reminder_days7Days after an order that the reminder is sent
auto_hide_reports5Reports at which a review is hidden automatically
verified_badge_onlyfalseShow only reviews from verified purchasers

Admin screen​

Admin tab reviews. Three tabs, with the active tab held in the URL hash under reviewsTab:

  • Overview — review activity.
  • Review Media — the media moderation queue, with approve and delete.
  • Settings — the options above.

Database schema​

Created by Schema/DatabaseSchema.php at schema version 1.0.0. The review itself stays a WordPress comment; these tables hold only the extras.

TableHolds
{prefix}aiowc_reviews_metaPros, cons, sub-ratings and the recommend flag, keyed by comment ID
{prefix}aiowc_reviews_votesHelpful votes and reports
{prefix}aiowc_reviews_mediaUploaded photos and videos, with their approval state

REST endpoints​

Namespace aiowc/v1. These return a bare response body rather than the shared envelope.

Public and customer​

MethodPathPurposeRequired argsPermission
GET/products/{product_id}/reviews/summaryRating summary for a productproduct_idRate-limited public read
GET/products/{product_id}/reviews/helpfulMost helpful reviews, up to limitproduct_idRate-limited public read
GET/reviews/{id}Read one review's extrasidRate-limited public read
POST/reviews/{id}/voteCast a helpful vote or a report; reason is optionalid, vote_typePublic write check
POST/reviews/{id}/metaSave pros, cons, sub-ratings and the recommend flagidReview owner
POST/reviews/{id}/mediaUpload a photo or videoidReview owner

Shop​

Permission: admin.

MethodPathPurposeRequired args
POST/reviews/{id}/replyPost the shop's reply to a reviewid, reply
GET/reviews/mediaMedia queue, filterable by status, up to limit—
POST/reviews/media/{id}/approveApprove one media itemid
DELETE/reviews/media/{id}Delete one media itemid
GET/reviews/settingsRead settings—
POST/reviews/settingsUpdate settings—

WooCommerce and WordPress integration​

HookEffect
woocommerce_before_single_product_reviewsRenders the rating summary
woocommerce_product_review_comment_form_argsAdjusts the review form arguments
comment_form_before_fieldsAdds the extended fields to the form
comment_postSaves the extended fields against the new comment
comment_textAdds the verified-purchase badge
woocommerce_review_after_comment_textRenders review media, and the voting buttons
wp_enqueue_scriptsLoads the module's assets
delete_commentRemoves the module's rows for a deleted review

No shortcode and no block are registered.

Background jobs​

Both run through Action Scheduler in the aiowc-reviews group.

HookSchedulePurpose
aiowc_reviews_moderationHourlyHides reviews whose report count has reached auto_hide_reports; the shop notice is rate-limited to once a day per review
aiowc_reviews_send_remindersDaily, first run at 10:00Emails customers reminder_days after their order asking for a review

Entitlement limits​

reviews is a free-tier entitlement, so the module is available without a premium licence. max_photos is a per-review setting rather than a licence limit, and no cap on reviews, votes or total media is implemented.