Site logo

Archived topic

How to remove WooCommerce single product image click

7 replies · Started by jdaco on August 6, 2017

Viewing posts 1–8 of 8

Hello, I want to remove the clickable function on the WooCommerce single product image, including the magnifying glass icon at the image´s top right corner, any tips?

Thank you!

Jorge

Hi there,

Try adding this function:

add_action( 'wp', 'tu_disable_wc_zoom', 50 );
function tu_disable_wc_zoom() {
    remove_theme_support( 'wc-product-gallery-lightbox' );
}

Hello Tom, thanks, that did remove the Zoom icon, but there remains a link on the single product image (featured image) that opens the picture file and that I wish to remove.

You could try this:

function tu_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', 'tu_single_product_image_html', 10, 2);

Hi Tom, I tried your function but it didn´t work. Finaly I came across with this solution:

add_filter('woocommerce_single_product_image_thumbnail_html','wc_remove_link_on_thumbnails' );
function wc_remove_link_on_thumbnails( $html ) {
     return strip_tags( $html,'<img />' );
} 

Thanks for your support!

Awesome! Thanks for sharing the code :)

Crazy, but didn't work for me. Added this snippet and that did the magic. Just in case someone is as desperate as I was :D

add_filter('woocommerce_single_product_image_thumbnail_html','wc_remove_link_on_thumbnails' );
 
function wc_remove_link_on_thumbnails( $html ) {
     return strip_tags( $html,'<img>' );
}

Thanks for sharing!

This archived topic is closed to new replies.