How To Remove the Featured Image from WooCommerce Product Gallery

Product Gallery on single product pages in WordPress include the product’s featured image by default. If you are looking to exclude it so only the gallery images are shown, add the following in child theme‘s functions.php or a code snippets plugin:

add_filter( 'woocommerce_single_product_image_thumbnail_html', function ( $html, $post_thumbnail_id ) {
	global $product;

	if ( $post_thumbnail_id === $product->get_image_id() )
		$html = '';

	return $html;
}, 10, 2 );

Reference

/wp-content/themes/bricks/includes/woocommerce/elements/product-gallery.php

Instant access to 390+ Bricks code tutorials with BricksLabs Pro

Leave the first comment