Code Duplication    Length = 13-19 lines in 4 locations

templates/cart/cross-sells.php 1 location

@@ 43-61 (lines=19) @@
40
$woocommerce_loop['name']    = 'cross-sells';
41
$woocommerce_loop['columns'] = apply_filters( 'woocommerce_cross_sells_columns', $columns );
42
43
if ( $products->have_posts() ) : ?>
44
45
	<div class="cross-sells">
46
47
		<h2><?php _e( 'You may be interested in&hellip;', 'woocommerce' ) ?></h2>
48
49
		<?php woocommerce_product_loop_start(); ?>
50
51
			<?php while ( $products->have_posts() ) : $products->the_post(); ?>
52
53
				<?php wc_get_template_part( 'content', 'product' ); ?>
54
55
			<?php endwhile; // end of the loop. ?>
56
57
		<?php woocommerce_product_loop_end(); ?>
58
59
	</div>
60
61
<?php endif;
62
63
wp_reset_query();
64

includes/class-wc-shortcodes.php 1 location

@@ 404-416 (lines=13) @@
401
402
		$products = new WP_Query( apply_filters( 'woocommerce_shortcode_products_query', $args, $atts ) );
403
404
		if ( $products->have_posts() ) : ?>
405
406
			<?php woocommerce_product_loop_start(); ?>
407
408
				<?php while ( $products->have_posts() ) : $products->the_post(); ?>
409
410
					<?php wc_get_template_part( 'content', 'product' ); ?>
411
412
				<?php endwhile; // end of the loop. ?>
413
414
			<?php woocommerce_product_loop_end(); ?>
415
416
		<?php endif;
417
418
		wp_reset_postdata();
419

templates/single-product/related.php 1 location

@@ 47-65 (lines=19) @@
44
$woocommerce_loop['name']    = 'related';
45
$woocommerce_loop['columns'] = apply_filters( 'woocommerce_related_products_columns', $columns );
46
47
if ( $products->have_posts() ) : ?>
48
49
	<div class="related products">
50
51
		<h2><?php _e( 'Related Products', 'woocommerce' ); ?></h2>
52
53
		<?php woocommerce_product_loop_start(); ?>
54
55
			<?php while ( $products->have_posts() ) : $products->the_post(); ?>
56
57
				<?php wc_get_template_part( 'content', 'product' ); ?>
58
59
			<?php endwhile; // end of the loop. ?>
60
61
		<?php woocommerce_product_loop_end(); ?>
62
63
	</div>
64
65
<?php endif;
66
67
wp_reset_postdata();
68

templates/single-product/up-sells.php 1 location

@@ 44-62 (lines=19) @@
41
$woocommerce_loop['name']    = 'up-sells';
42
$woocommerce_loop['columns'] = apply_filters( 'woocommerce_up_sells_columns', $columns );
43
44
if ( $products->have_posts() ) : ?>
45
46
	<div class="up-sells upsells products">
47
48
		<h2><?php _e( 'You may also like&hellip;', 'woocommerce' ) ?></h2>
49
50
		<?php woocommerce_product_loop_start(); ?>
51
52
			<?php while ( $products->have_posts() ) : $products->the_post(); ?>
53
54
				<?php wc_get_template_part( 'content', 'product' ); ?>
55
56
			<?php endwhile; // end of the loop. ?>
57
58
		<?php woocommerce_product_loop_end(); ?>
59
60
	</div>
61
62
<?php endif;
63
64
wp_reset_postdata();
65