<?php $kproduct = get_query_var('kproduct'); ?>
<?php $woo_currency = get_woocommerce_currency_symbol(); ?>
<div class="product-twelve d-flex align-items-center position-relative bg-white radius-15">
<?php if($kproduct['kaveh_custom']['product_stock_status'] === 'outofstock'): ?>
<div class="status">
ناموجود
</div>
<?php endif; ?>
<?php if ( is_plugin_active( 'woo-smart-compare/wpc-smart-compare.php' ) ): ?>
<?php echo do_shortcode( '[woosc id="".<?php echo get_the_ID(); ?>.""]' );  ?>
<?php endif; ?>
<img src="<?php echo $kproduct['kaveh_custom']['thumbnail_url'] ?>" alt="product" class="imagestp13" />
<?php if ( $kproduct['kaveh_custom']['is_on_sale'] === true ): ?>
<div class="offer position-absolute text-white top-0 rounded-circle text-center">
<?php if($kproduct['kaveh_custom']['product_type'] === 'variable'): ?>
    <?php echo (int)(( ( (float)$kproduct['kaveh_custom']['min_regular_price'] - (float)$kproduct['kaveh_custom']['min_sale_price'] ) / (float)$kproduct['kaveh_custom']['min_regular_price'] ) * 100); ?><?php echo ' '.'%'; ?>
<?php elseif($kproduct['kaveh_custom']['product_type'] === 'simple'): ?>
    <?php echo (int)(( ( (float)$kproduct['kaveh_custom']['normal_price'] - (float)$kproduct['kaveh_custom']['sale_price'] ) / (float)$kproduct['kaveh_custom']['normal_price'] ) * 100); ?><?php echo ' '.'%'; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="detail w-100">
<h2 class="overflow-hidden fw-bold">
<a href="<?php echo $kproduct['link'] ?>"><?php echo $kproduct['title']['rendered']; ?></a>
</h2>
<?php if($kproduct['kaveh_custom']['product_stock_status'] !== 'outofstock'): ?>
<?php if($kproduct['kaveh_custom']['product_type'] !== 'variable'): ?>
<div class="price fw-light">
<b>  <?php if(!empty($kproduct['kaveh_custom']['normal_price'])): ?>
<?php echo number_format($kproduct['kaveh_custom']['normal_price'], 0, '.', ','); ?>
<?php endif; ?> </b>
<?php echo $woo_currency; ?>
</div>
<?php else: ?>
<div class="price fw-light">
<b> <?php if($kproduct['kaveh_custom']['min_regular_price'] !== $kproduct['kaveh_custom']['max_regular_price']): ?>
    <?php if(!empty($kproduct['kaveh_custom']['min_regular_price'])): ?>
    <?php echo number_format($kproduct['kaveh_custom']['min_regular_price'], 0, '.', ',') . ' - ' . number_format($kproduct['kaveh_custom']['max_regular_price'], 0, '.', ',') . ' '; ?>
<?php endif; ?>
<?php else: ?>
    <?php if(!empty($kproduct['kaveh_custom']['min_regular_price'])): ?>
    <?php echo number_format($kproduct['kaveh_custom']['min_regular_price'], 0, '.', ',')  . ' '; ?>
<?php endif; ?>
<?php endif; ?> </b>
<?php echo $woo_currency; ?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>