<?php
$product = wc_get_product(get_the_ID());
$sale_price = $product->get_sale_price();
$normal_price = $product->get_regular_price();
$options = kaveh_get_options();
$woo_currency = get_woocommerce_currency_symbol();
$min_regular_price = NULL;
$max_regular_price = NULL;
$min_sale_price = NULL;
$max_sale_price = NULL;
if ($product->is_type('variable')) {
  $min_regular_price = $product->get_variation_regular_price('min');
  $max_regular_price = $product->get_variation_regular_price('max');
  $min_sale_price = $product->get_variation_sale_price('min');
  $max_sale_price = $product->get_variation_sale_price('max');
}
$pr_id = get_the_ID();
$stocka = $product->get_stock_status();
?>
<div <?php wc_product_class('product product-ten gradient', $product); ?>>
  <div class="product-image">
                <?php if($options['kaveh_compare_system'] === '1'): ?>   

     <?php echo do_shortcode('[compare_button id='. get_the_ID() .' style="icon_text" radius="50" tag="a" class="kaveh_compare_top"]'); ?>
                               <?php endif; ?>

    <?php
    if ("instock" != $stocka) { ?>
      <div class="status">
        <?php esc_html_e('Out of Stock', 'kavehTheme'); ?>
      </div>
    <?php } ?>
    <a href="<?php the_permalink(); ?>">
      <img src="<?php if(get_the_post_thumbnail_url()): ?>
<?php the_post_thumbnail_url('full'); ?>
<?php else: ?>
<?php echo wc_placeholder_img_src(); ?>
<?php endif; ?>" alt="<?php
$title = get_the_title();
$show_full_titles = kaveh_get_option('kaveh_product_title_display', false);
if ($show_full_titles) {
    echo esc_html($title);
} else {
    if ( wp_is_mobile() ) {
        echo wp_trim_words( $title, 5, '...' );
    } else {
        echo wp_trim_words( $title, 8, '...' );
    }
}
?>">
    </a>
  </div>
  <div class="detail">
  <div class="price">
    <?php
        // Use WooCommerce's built-in price HTML output
        $price_html = $product->get_price_html();
        // If we have price HTML (not empty)
        if ($price_html) {
            echo $price_html;
        }
        ?>
    </div>
    <h2>
      <a href="<?php the_permalink(); ?>"> <?php
$title = get_the_title();
if ( wp_is_mobile() ) {
    echo wp_trim_words( $title, 5, '...' );
} else {
    echo wp_trim_words( $title, 8, '...' );
}
?></a>
    </h2>
    <?php if (!empty($normal_price)) { ?>
      <?php if ("instock" == $stocka) { ?>
        <button type="button" class="add-to-cart single_add_to_cart_button position-relative cart11"
          value="<?php echo $pr_id; ?>">
          <span> + </span>
          <span><?php esc_html_e('Add to Cart', 'kavehTheme'); ?></span>
        </button>
      <?php }
    } ?>
  </div>
</div>