Hi,
How can I add star ratings under 'Add to Cart' button. Below is the screenshot.
Hi,
How can I add star ratings under 'Add to Cart' button. Below is the screenshot.
You can try to add following code to functions.php (at the very bottom):
add_filter( 'woocommerce_after_add_to_cart_button', 'ino_add_rating_stars' );
function ino_add_rating_stars()
{
global $product;
echo $product->get_rating_html();
}
You can also try to use the woocommerce_after_add_to_cart_button instead of the woocommerce_before_add_to_cart_button hook.
Hi,
Thanks! The code still not working. Now it doesn't color the stars based on previous reviews.
Please see below screenshot.
Hey!
My mistake - I used the code for the single star rating. I adjusted the code and it will display the average rating now.
Best regards,
Peter
You are genius Peter. Thanks the above code is working fine.
This topic has been closed to new replies.