With Woocommerce and my Storefront child theme, I am trying to prevent the fact that when clicking on a single-product image, it opens a new page with the full size image.
I want the image to be unclickable so nothing happens if the user clicks on the image in the product page.
In my child-theme functions.php, the following code prevents zooming and opening the image in a lightbox, but I want to fully deactivate the linking.
add_action( 'after_setup_theme', 'remove_hemen_theme_support', 100 );
function remove_hemen_theme_support() {
remove_theme_support( 'wc-product-gallery-zoom' );
remove_theme_support( 'wc-product-gallery-lightbox' );
}
How can I achieve this?
3
Answers
Add this filter, it should remove your hyperlink
How I did it with the same theme.
I created a simple plugin (but you can use functions.php) with functions I need for override the theme and inside I have this code:
The difference between our function is that I am using "wp" instead "after_setup_theme".
Try it and let me know if is work.
you can overwrite the template woocommerce/single-product/product-thumbnails.php in your theme.
it runs the: