<?php
/**
 * The template for displaying product content within slides.
 *
 * @package shrk framework
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

global $product;

// Ensure visibility
if ( ! $product || ! $product->is_visible() ) {
	return;
}
?>
<div <?php post_class( array( 'swiper-slide', 'product' ) ); ?> >

<?php 
if ( $cover_atts['thumb_only'] ) {
	$img         = wp_get_attachment_image_src( get_post_thumbnail_id(), 'shrk_section_bg' );
	$img_src     = $img[0];
	$img_src_set = wp_get_attachment_image_srcset( get_post_thumbnail_id(), 'shrk_section_bg' );
	$img_ar      = shrk_get_image_aspect( get_post_thumbnail_id(), 'shrk_section_bg' );
} else {
	$img_src     = shrk_get_cover_image( $cover_atts ); 	
	$img_src_id  = shrk_get_cover_image( $cover_atts, true );
	$img_src_set = wp_get_attachment_image_srcset( $img_src_id, 'shrk_section_bg' );
	$img_ar      = shrk_get_image_aspect( $img_src_id, 'shrk_section_bg' );
}
?>

	<?php do_action( 'shrk_slide_before_shop_loop_item' ); ?>

	<?php if ( $img_src ) : ?>
		<div class="slide-background slide-inner-image lazyload-bg" data-image-bg="<?php echo esc_url( $img_src ); ?>" data-srcset="<?php echo esc_attr( $img_src_set ); ?>" data-image-ar="<?php echo esc_attr( $img_ar ); ?>"></div>
	<?php endif; ?>

	<div class="slide-content-wrap">
		<div class="slide-content">
			<?php
				/**
				 * shrk_slide_before_shop_loop_item_title hook
				 *
				 * @hooked woocommerce_show_product_loop_sale_flash - 10
				 */
				do_action( 'shrk_slide_before_shop_loop_item_title' );

				/**
				 * shrk_slide_shop_loop_item_title hook
				 *
				 * @hooked woocommerce_template_loop_product_title - 10
				 */
				do_action( 'shrk_slide_shop_loop_item_title' );

				/**
				 * shrk_slide_after_shop_loop_item_title hook
				 *
				 * @hooked woocommerce_template_loop_price - 10
				 * @hooked woocommerce_show_product_loop_sale_flash - 10
				 * @hooked woocommerce_template_single_excerpt - 15
				 */
				do_action( 'shrk_slide_after_shop_loop_item_title' );
		
				/**
				 * shrk_slide_after_shop_loop_item hook
				 *
				 * @hooked woocommerce_template_loop_add_to_cart - 10
				 */
				do_action( 'shrk_slide_after_shop_loop_item' );
			?>
		</div>
	</div>
</div>
