<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( $recently_products ) : ?>

	<section
		class="c-product__products c-product__products--related c-product__products--<?php echo esc_attr( ideapark_mod( 'product_grid_width' ) ); ?> l-section <?php if ( is_shop() ) {
			ideapark_class( ideapark_mod( 'product_grid_width' ) == 'fullwidth', 'l-section--container-wide', 'l-section--container' );
		} ?>">

		<?php
		$heading = apply_filters( 'woocommerce_product_recently_products_heading', __( 'Recently viewed products', 'goldish' ) );
		if ( $heading ) { ?>
			<div class="c-product__products-title"><?php echo esc_html( $heading ); ?></div>
		<?php } ?>

		<?php woocommerce_product_loop_start(); ?>

		<?php foreach ( $recently_products as $recently_product_id ) : ?>

			<?php
			$post_object = get_post( $recently_product_id );

			setup_postdata( $GLOBALS['post'] =& $post_object );

			wc_get_template_part( 'content', 'product' ); ?>

		<?php endforeach; ?>

		<?php woocommerce_product_loop_end(); ?>

	</section>

<?php endif;

wp_reset_postdata();
