Add options/toggle to hide thumbnail on WC Product Page

Hi,

I needed to remove the product thumbnail from the product page and show only the gallery in some cases. But, Kalium doesn’t offer a toggle for this.

Hooks didn’t work, and the function can’t be overridden via the child themes functions.php. The only way I found was to edit Kalium’s core files, which obviously isn’t ideal from a maintenance standpoint.

Therefore my suggestion is, to change this

<?php
# includes/functions/woocommerce/functions.php:L157

// Get first image 
if ( has_post_thumbnail( $product_id ) ) {
	$images[] = get_post_thumbnail_id( $product_id );
}

?>

to sth. like this and also add the correlating options:

<?php
# includes/functions/woocommerce/functions.php:L157

// Get first image
if ( kalium_get_theme_option( 'show_thumbnail_on_product_page' ) ) {
	if ( get_post_meta( $product_id, '_show_thumbnail_on_product_page' ) ) {
		if ( has_post_thumbnail( $product_id ) ) {
			$images[] = get_post_thumbnail_id( $product_id );
		}
	}
}

?>


The first if controls global behavior, while the second if handles product-specific logic.

Kind regards
Nebbi

Please authenticate to join the conversation.

Upvoters
Status

In Review

Board

💡 Feature Request

Date

8 months ago

Author

dasnebbi

Subscribe to post

Get notified by email when there are changes.