Created
July 26, 2021 09:02
-
-
Save mitchellkrogza/fca1336b6b3744d77524478348d3391b to your computer and use it in GitHub Desktop.
Woocommerce - hide featured image on single-product page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This removes the featured image from the single product page | |
// Your First Gallery Image becomes the main image | |
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment