Skip to content
Advertisement

I have an issue with product reviews summary bars WooCommerce

I want to create a product review summary just like this: enter image description here

And this is my try, it works like I want but the problem is not working for each product, it gives a summary of all products ๐Ÿ™ And I think my way is not professional as well!

My code:

JavaScript

I just need it to work for each product, not for all products, please any help?

Advertisement

Answer

I have found a solution myself and may help you too :), by the way, Iโ€™ve created a new function on functions.php

JavaScript

To retrieve the output you just need to add this code inside the single-product-reviews.php you can find it on WooCommerce templates and then add this code to the place you want to display a Reviews Summary Bars.

JavaScript

And I have create a variable for product ID just like this:

JavaScript

The result is just like this, but you will need to customize it as you want using CSS! enter image description here

I hope that helps you ๐Ÿ™‚

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement