• I have successfully disabled the Lightbox feature in WooCommerce, but when I click on the image, it opens in a new tab. I don’t want the images to be clickable at all.

    Site: https://goo.gl/7dC432

    I found this code but I am getting syntax errors when I add it to the bottom of my themes functions.php file.

    add_filter( 'woocommerce_single_product_image_html', function( $html, $product_id ) {
    
      if ( has_post_thumbnail() ) {
        $image_title 		= esc_attr( get_the_title( get_post_thumbnail_id() ) );
        $image = get_the_post_thumbnail( $product_id, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ), array(
          'title' => $image_title
        ) );
      $html = $image;
      }
    
      return $html;
    } );

    Help is appreciated! Thanks in advance! ??

  • The topic ‘WooCommerce Lighbox Disabled but I don't want image to be clickable’ is closed to new replies.