<?php
/**
 * Cross-sells
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/cart/cross-sells.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 4.4.0
 */

defined('ABSPATH') || exit;

global $options;
$ht_slider_crosssell = irk_get_head_tag('ht-slider-crosssell', ['class' => 'title']);
$ht_slider_crosssell_title = irk_get_head_tag('ht-slider-crosssell-title', ['class' => 'title clearfix']);

if ($cross_sells) : ?>
    <div class="cross-sells widget-products-slider widget">
        <header class="header">
            <?php echo $ht_slider_crosssell_title['open'] . '<span>' . __('You may be interested in&hellip;', 'woocommerce') . '</span>' . $ht_slider_crosssell_title['close']; ?>
        </header>
        <div class="slider-inner">
            <div class="owl-carousel">
                <?php foreach ($cross_sells as $cross_sell) : ?>
                    <?php
                    $product_id = $cross_sell->get_id();
                    $product = wc_get_product($product_id);
                    ?>
                    <div <?php wc_product_class('item', $product_id); ?>>
                        <a href="<?php echo $product->get_permalink(); ?>" title="<?php echo $product->get_name(); ?>">
                            <div class="img-wrapper">
                                <?php echo $product->get_image('woocommerce_thumbnail', ['class' => 'img-fluid']); ?>
                            </div>
                            <?php echo $ht_slider_crosssell['open'] . $product->get_name() . $ht_slider_crosssell['close']; ?>
                            <?php echo $product->get_price_html(); ?>
                        </a>
                    </div>
                <?php endforeach; ?>
            </div>
        </div>
    </div>
<?php
endif;
wp_reset_postdata();
