Hi I am trying to get ratings for each review. I am able to get the reviews for each product. This is my review variable $_review but when I tried to get rating it doesn't work. The below code should work, but it returns Error filtering template: Warning: count(): Parameter must be an array or an object that implements Countable

<?php if (count($_review->getRatingVotes())) : ?>

Am I missing something here?

1 Answer 1


I figured it out. I am missing something on the function. I am posting the full function here:

public function getReviewCollection($productId){
        $product = $this->productRepository->getById($productId);
        $collection = $this->_reviewCollection->create()

        return $collection->getItems(); //Get all review data of product

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.