Remove featured image from product page gallery
-
Hi,
I need some help please, with a customization that I need to do on my woocommerce.
So, for a product I have set a featured image ( product image ) and I have added 4 pictures in the product gallery too.I need to make it so that the featured image is NOT displayed on the product page itself. Basically make it so that when viewing a product, only the images in the gallery are displayed
I have tried using the following code in functions.php
add_filter('woocommerce_single_product_image_thumbnail_html', 'remove_featured_image', 10, 2); function remove_featured_image($html, $attachment_id ) { global $post, $product; $featured_image = get_post_thumbnail_id( $post->ID ); if ( $attachment_id == $featured_image ) $html = ''; return $html; }
This works but with one big issue.
Basically this does remove the featured image from the product page but the little thumbnails near that allow you to switch pictures on the product page still contain the featured image thumb
So the first picture in the gallery is displayed now as the first picture but the little thumbnail for it is actually from the product/featured image.If anyone has a suggestion on how to fix this please, I would be in your debt.
Thank you
Claudiu
- The topic ‘Remove featured image from product page gallery’ is closed to new replies.