CodeVibrant › Forums › Easy Mart › Star rating in the loop is not accurate
Tagged: star rating
- This topic has 3 replies, 3 voices, and was last updated 4 years, 1 month ago by myrtle.rankind.
- AuthorPosts
- December 26, 2019 at 10:35 am #3903dragoecoParticipant
Hi there, I see a huge difference with the product star rating between your theme and WooCommerce:
I fixed the problem by replacing the function add_star_rating() in inc/woocommerce.php, line 415:
function child_custom_actions() { remove_action('woocommerce_after_shop_loop_item_title', 'add_star_rating', 5 ); } add_action( 'init' , 'child_custom_actions' ); function add_star_rating_loop(){ global $woocommerce, $product; $average = $product->get_average_rating(); echo '<div class="star-rating"><span style="width:' . ( ( $average / 5 ) * 100 ) . '%"></span></div>'; } add_action('woocommerce_after_shop_loop_item_title', 'add_star_rating_loop', 5 );
I’m not an expert with PHP but this issue seems to be fixed only by removing the absint() function. I guess there is a good reason if your dev added it into the theme and that’s why I share my “investigation” with you 🙂
Regards
Pierre
December 27, 2019 at 6:21 am #3915AnonymousInactiveHey there,
You find out the significant issue. Thank you for this “comment” this will surely help us to improve our product. We will fixed it asap and push you the updates.Regards,
Codevibrant Supprt Team.December 27, 2019 at 10:50 am #3924dragoecoParticipantAlright, you’re welcome 😉 Happy new years guys!
February 21, 2020 at 12:11 pm #4214myrtle.rankindParticipantHappy New Chinese Year guys!
- AuthorPosts
- You must be logged in to reply to this topic.