Archived topic
Shop - Not link the product image separately
7 replies · Started by Frank on May 28, 2021
Hello.
I need a solution - but can't find anything in the topic.
Refers to: Shop -> Product -> Detail page -> Product picture
I do NOT want to connect the product image via a link (URL) so that it is displayed separately. Therefore, it should only be displayed on the product page without being clickable.
so it is not a problem that generate press produces errors.
Unfortunately, I don't know if I expressed myself well enough for you guys ... I hope so. ;-)
regards
Frank
Hi there,
do you mean the Lightbox that is displayed when you click on a product image ?
If so thats a Woocommerce function - Leo provides a PHP Snippet here to disable that:
https://generatepress.com/forums/topic/disable-lightbox-image-zoom-woocommerce/#post-1251668
Hi David,
SUPER !!!!!!
Both gone (magnifying glass / lightbox).
Perfect - just like that.
I thank you for the quick and perfect help.
Greeting
Frank
Munic/Germany
You're welcome
Hello David.
I hope it is right to discuss the topic again here than to open up a new topic ?!
You recently helped me with the lightbox. Everything worked out so far. Unfortunately, I have now found a bug.
With the "product variants" ...
I have deposited a picture for each variant. When I choose the variant, he shows me the corresponding picture.
When this error occurs, there is only one image left - no matter what is selected.
Example https://ekm-chemnitz.de/p/led-lichterbogen-asymetrisch/
Can you adapt Leo's code to it?
#####
// Lightbox und Lupe AUS
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 />' );
}
function remove_image_zoom_support() {
remove_theme_support( 'wc-product-gallery-zoom' );
remove_theme_support( 'wc-product-gallery-lightbox' );
}
add_action( 'wp', 'remove_image_zoom_support', 100 );
#####
thanks & regards
Frank
Hi there,
Not too sure what you mean here - your link redirected to your homepage.
Any chance you can explain a bit more and check the link?
Thanks!
Hi Tom,
This is the redirection - we don't have the shop publicly online yet.
But - the problem was solved yesterday evening - I found an article in a post on Wordpress that eliminates the problem.
Therefore - problem solved - the code attached if someone needs it.
many thanks for your help
Frank
// Lightbox und Lupe AUS
add_filter('woocommerce_single_product_image_thumbnail_html','wc_remove_link_on_thumbnails' );
function wc_remove_link_on_thumbnails( $html ) {
return strip_tags( $html,'<div><img>' );
}
function remove_image_zoom_support() {
remove_theme_support( 'wc-product-gallery-zoom' );
remove_theme_support( 'wc-product-gallery-lightbox' );
}
add_action( 'wp', 'remove_image_zoom_support', 100 );
Glad you got it working - thanks for sharing the code! :)