<?php
defined('ABSPATH') || exit('No Access!');

$ht_promotion_single = irk_get_head_tag('ht-promotion-single', ['class' => 'title']);

$p_args = array(
    'post_type' => 'product',
    'posts_per_page' => -1,
    'post__in' => irk_generate_post__in($post__in),
);

$products = new WP_Query($p_args);
?>
<?php if ($products->have_posts()): ?>
    <div class="promotion-slider">
        <div class="owl-carousel">
            <?php while ($products->have_posts()): ?>
                <?php
                $products->the_post();
                $product_id = $products->post->ID;
                $product = wc_get_product($product_id);
                if (!$product) {
                    continue;
                }
                ?>
                <div <?php wc_product_class('item', $product_id); ?>>
                    <div class="progressbar-wrapper">
                        <span class="progressbar"></span>
                    </div>
                    <a href="<?php echo $product->get_permalink(); ?>" title="<?php echo $product->get_title(); ?>">
                        <?php echo $product->get_image('woocommerce_thumbnail', ['class' => 'img-fluid']); ?>
                        <?php echo $ht_promotion_single['open'] . $product->get_name() . $ht_promotion_single['close']; ?>
                        <?php echo $product->get_price_html(); ?>
                    </a>
                </div>
            <?php endwhile; ?>
        </div>
    </div>
    <?php wp_reset_postdata(); ?>
<?php endif; ?>