Support » Plugin: Site Reviews » Ratings with two decimal places

  • Resolved ghufransiddiqui2k

    (@ghufransiddiqui2k)


    How can i show rating with two decimal places, it is showing as 4.8, 4.9 but i want to show it as 4.98, 4.56. please guide me how can i achieve it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    1. Update to v4.2.6
    2. Use the following hook:

    add_filter('site-reviews/rating/average', function ($roundedAverage, $ratingCounts, $average) {
        return round($average, 2);
    }, 10, 3);

    Or, if you want to always have two decimal points (i.e. display 4 as 4.00), do this:

    add_filter('site-reviews/rating/average', function ($roundedAverage, $ratingCounts, $average) {
        return sprintf('%0.2f', round($average, 2));
    }, 10, 3);
    ghufransiddiqui2k

    (@ghufransiddiqui2k)

    working! thanks for your support.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.