Advertisement
afsarwebdev

Woocommerce Product Star Rating Display

Apr 13th, 2023
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. // wc star rating shows
  2. // step one: woocommerce->settings>product->check box enable star rating
  3. // step two: in section class="woocommerce"
  4.  
  5. <div class="reviews">
  6. <?php
  7. global $product;
  8. if ( get_option( 'woocommerce_enable_review_rating' ) === 'no' ) {
  9. return;
  10. }
  11. $rating_count = $product->get_rating_count();
  12. $review_count = $product->get_review_count();
  13. $average_rating = $product->get_average_rating();
  14. if ( $rating_count > 0 ) :
  15. echo wc_get_rating_html($average_rating, $rating_count);
  16. endif;
  17. ?>
  18. </div>
Tags: woocommerce
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement