<?php $kproduct = get_query_var('kproduct'); ?>
<?php $woo_currency = get_woocommerce_currency_symbol(); ?>
<div class="product product1 maip">
<div class="product-image">
<?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; ?>
<?php if ( $kproduct['kaveh_custom']['is_on_sale'] === true ): ?>
<div class="discount">
<?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; ?>
<?php if($kproduct['kaveh_custom']['product_stock_status'] === 'outofstock'): ?>
<div class="status">
ناموجود
</div>
<?php endif; ?>
<a href="<?php echo $kproduct['link'] ?>">
<img src="<?php echo $kproduct['kaveh_custom']['thumbnail_url'] ?>" alt="<?php echo $kproduct['title']['rendered']; ?>" />
</a>
</div>
<div class="detail">
<h2>
<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'): ?>
<?php if ( $kproduct['kaveh_custom']['is_on_sale'] === true ): ?>
<div class="offer">
<?php if(!empty($kproduct['kaveh_custom']['normal_price'])): ?>
<?php echo number_format($kproduct['kaveh_custom']['normal_price'], 0, '.', ','); ?>
<?php endif; ?>
</div>
<div class="price">
<?php if(!empty($kproduct['kaveh_custom']['sale_price'])): ?>
    <?php echo number_format($kproduct['kaveh_custom']['sale_price'], 0, '.', ','); ?>
<?php endif; ?>
<span> <?php echo $woo_currency; ?> </span>
</div>
<?php else: ?>
<div class="price">
<?php if(!empty($kproduct['kaveh_custom']['normal_price'])): ?>
<?php echo number_format($kproduct['kaveh_custom']['normal_price'], 0, '.', ','); ?>
<?php endif; ?>
<span> <?php echo $woo_currency; ?></span>
</div>
<?php endif; ?>
<?php else: ?>
<div class="price">
<?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; ?>
<span> <?php echo $woo_currency; ?></span>
</div>
<?php endif; ?>
<?php endif; ?>
<div class="product-hover">
<?php if($kproduct['kaveh_custom']['product_type'] !== 'variable'): ?>
<a href="<?php echo $kproduct['link'] ?>" class="btn btn-secondary rounded-pill"> مشاهده محصول </a>
<?php else: ?>
<a href="<?php echo $kproduct['link'] ?>" class="btn btn-secondary rounded-pill"> مشاهده گزینه ها</a>
<?php endif; ?>
<?php if($kproduct['kaveh_custom']['product_type'] !== 'variable'): ?>
<?php if($kproduct['kaveh_custom']['product_stock_status'] !== 'outofstock'): ?>
<button type="submit" name="add-to-cart" value="<?php echo $kproduct['id']; ?>" class="single_add_to_cart_button btn btn-secondary rounded-circle icarrt">
<i class="icon icon-cart-3"></i>
</button>
<?php endif; ?>
<?php endif; ?>
<?php if ( is_plugin_active( 'woo-smart-wishlist/wpc-smart-wishlist.php' ) ): ?>
<?php echo do_shortcode( '[woosw id="".<?php echo get_the_ID(); ?>.""]' ); ?>
<?php endif; ?>
<button id="eyeid" type="button" class="btn btn-secondary rounded-circle eyeid" data-bs-toggle="modal" data-bs-target="#modal-product" value="<?php echo $kproduct['id']; ?>">
<i class="isax isax-eye3"></i>
</button>

</div>
</div>
</div>