[Resolved] How to remove WooCommerce single product image click

Home Forums Support How to remove WooCommerce single product image click

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #360768
    jdaco

    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

    GeneratePress 1.3.48
    GP Premium 1.3.1
    #360847
    Tom
    Lead Developer
    Lead Developer

    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' );
    }
    #361083
    jdaco

    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.

    #361166
    Tom
    Lead Developer
    Lead Developer

    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);
    #361221
    jdaco

    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!

    #361417
    Tom
    Lead Developer
    Lead Developer

    Awesome! Thanks for sharing the code 🙂

    #424139
    feda

    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 😀

    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>' );
    }
    #424164
    Leo
    Staff
    Customer Support
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.