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
4 comments
EZ Smith
This doesn't seem to be working on newer versions of Bricks (2.2+), any updates?
Sridhar Katakam
Just tested and works fine here. Make sure there's a "Product gallery" element in your single product template.
If it still doesn't work, I can take a look inside. Need WP admin login for that. Send via /support. https://wordpress.org/plugins/temporary-login-without-password/
Javiera
Thank you so much!
Jacqui
Hi, thanks, this does indeed remove the featured image. However, on a variable product, the main gallery image no longer swaps out when selections are made. The thumbnail below the main image still does though.