Better Woocommerce Star Ratings Shortcode Plugin
This wonderfully simple but effective plugin allows you to show Woocommerce Star Ratings for any product, anywhere on your site.
It saved me a few hours of development time and my client a few hundred bucks on a recent project. The code is pretty solid and shouldn’t break–even though WordPress gives off the “It’s been two years since this plugin was updated…” warning–with future Woocommerce updates.
My client, however, wanted to display the ratings and then the average number just afterwards, like this:
I made several additional updates to this plugin and plan to submit have submitted it to the WordPress.org repository. The complete shortcode options are now:
[woocommerce_rating id=”n”] is the default. Replace “n” with the ID of the product you want to show the ratings for.
[woocommerce_rating id=”n” link=”false”] Add this if you don’t want the star rating to be a link.
[woocommerce_rating id=”n” newwindow=”true”] Add this if you want the link to open in a new window.
[woocommerce_rating id=”n” alttext=”Some alternative text”] This allows you to customize the text shown when a product has not yet been rated.
[woocommerce_rating id=”n” displayaverage=”true”] This will add a number, the average of all ratings for this product, after the stars, like ( 3.25 )
[woocommerce_rating id=”n” displaycount=”true”] This will add a number, the total number of ratings for this product, after the stars, like ( 420 )