Skip to content
Skip to content

Removing Main Product Image Link in Single Product View

When you're in a single product view, by default, clicking the main featured image will load a lightbox with the images. To remove this featured image link, follow these steps:

1. Create a child theme and a functions.php file if you don't have it yet.

2. In child theme functions.php file, paste the following code:


<?php
/**
 * Remove link wrapping main product image in single product view.
 * @param $html
 * @param $post_id
 * @return string
 */
function custom_themify_single_product_image_html( $html, $post_id ) {
	return get_the_post_thumbnail( $post_id, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ) );
}
add_filter('woocommerce_single_product_image_html', 'custom_themify_single_product_image_html', 10, 2);
?>

3. Save the child theme functions.php file. The thumbnails below the main image will remain unaffected, and clicking them will correctly load the lightbox gallery with these images.

NEW: Themify has been redesigned. Please comment your feedback.