<?php
/**
 * Single Product Rating
 *
 * Template aligned with WooCommerce 3.6.0
 * @see https://woocommerce.com/document/template-structure/
 * @package Pawfect
 * @version 10.9.1
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

global $product;

if ( ! wc_review_ratings_enabled() ) {
    return;
}

$rating_count = $product->get_rating_count();
$review_count = $product->get_review_count();
$average      = $product->get_average_rating();

if ( $rating_count > 0 ) : ?>

    <div class="woocommerce-product-rating pawfect-flex pawfect-items-center pawfect-space-x-2">
        <?php echo wc_get_rating_html( $average, $rating_count ); // WordPress.XSS.EscapeOutput.OutputNotEscaped. ?>
        <?php if ( comments_open() ) : ?>
            <?php //phpcs:disable ?>
            <a href="#reviews" class="woocommerce-review-link pawfect-text-text-light hover:pawfect-text-accent pawfect-transition-colors" rel="nofollow">
                (<?php printf( _n( '%s customer review', '%s customer reviews', $review_count, 'pawfect' ), '<span class="count">' . esc_html( $review_count ) . '</span>' ); ?>)
            </a>
            <?php // phpcs:enable ?>
        <?php endif ?>
    </div>

<?php endif; ?>

