Product Review
  • Get Started
    • Product Review
    • Requirements
    • Installation and Setup
    • Configuration
  • Reviews
    • Flow
    • Review
    • Available Functions
    • Available Custom Behavior
    • Submitting a review
Powered by GitBook
On this page
  1. Reviews

Available Functions

The following functions you can call in your twig.

craft.productReview.getAllReviews(rating, status, sort, limit)

Retrieve all customer-submitted reviews.

  • rating (optional): Filter reviews by rating value (1 to 5). Use null to show all ratings.

  • status(optional): Filter reviews based on status. Available options: live, pending, null. Default live.

  • sort (optional): Sort reviews, with the default being by dateCreated DESC.

  • limit (optional): Limit the number of reviews shown.

Example

{% set reviews = craft.productReview.getAllReviews(null, 'live', "rating DESC", 10) %}
{% for review in reviews %}
    {{ review.rating }}
{% endfor %}

craft.productReview.getReviewById(id, status)

Retrieve customer reviews based on ID.

  • id(required): ID of the review.

  • status(optional): Filter reviews based on status. Available options: live, pending, null. Default live.

Example

{% set review = craft.productReview.getReviewById(1) %}

craft.productReview.getPendingReviewById(id)

Retrieve pending customer reviews based on ID.

Example

{% set review = craft.productReview.getPendingReviewById(1) %}

PreviousReviewNextAvailable Custom Behavior

Last updated 11 months ago