<?php
/**
 * Loop Rating
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/loop/rating.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see     https://docs.woocommerce.com/document/template-structure/
 * @package WooCommerce/Templates
 * @version 3.6.0
 */

if (!defined('ABSPATH')) {
    exit;
}

global $product, $options, $labels;

$average_rating = $product->get_average_rating();
$compare_active = in_array($product->get_id(), irk_compare_list()) ? 'active' : '';

echo '<div class="product-rating clearfix">';
if ($options->get_option('catalog-compare')) {
    echo '<label class="add-to-compare ' . $compare_active . '" data-id="' . $product->get_id() . '"><input type="checkbox">' . esc_html($labels->get_label('compare')) . '</label>';
}
echo wc_review_ratings_enabled() && $average_rating ? '<div class="rating"><span class="icon" data-icon="staro-fill"></span>' . $average_rating . '</div>' : ''; // WordPress.XSS.EscapeOutput.OutputNotEscaped.
echo '</div>';

if ($options->get_option('catalog-stock')) {
    $availability = $product->get_availability();
    if ($availability['availability']) {
        echo '<div class="stock ' . esc_attr($availability['class']) . '">';
        echo '<span class="icon" data-icon="Icon-Badges-Return"></span>';
        echo esc_html($availability['availability']);
        //$low_stock = irk_get_product_threshold($product->get_id());
        //echo intval( $low_stock ) ? '<span>' . $low_stock . ' ' . $labels->get_label( 'exists-in-stock' ) . '</span>' : '';
        echo '</div>';
    }
}