Preview:
function customRatingScoreHTML($productID)
{
  $product = wc_get_product($productID);
  $average      = $product->get_average_rating();
  $rating_whole = floor($average);
  $rating_fraction = $average - $rating_whole;
  $flug = 0;
  for ($i = 1; $i <= 5; $i++) {
    if ($i <= $rating_whole) {
      echo '<i class="fas fa-star"></i>';
    } else {
      if ($rating_fraction > 0 && $flug == 0) {
        echo '<i class="fas fa-star-half-alt"></i>';
        $flug = 1;
      } else {
        echo '<i class="far fa-star empty"></i>';
      }
    }
  }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter