We help IT Professionals succeed at work.

Need to disable Hover Zoom on Single product pages in WooCommerce

Alicia St Rose
on
High Priority
52 Views
Last Modified: 2020-03-07
This code is everywhere on the web, however it doesn't work.

function remove_image_zoom_support() {
    remove_theme_support( 'wc-product-gallery-zoom' );
}
add_action( 'wp', 'remove_image_zoom_support', 100 );

Open in new window

Here is an example page:

http://sandbox.intrepidrealist.com/cazoozsb/product/ukulele-for-beginners/

I really need to disable the Zoom on single product views. are there any Woo experts out there who've accomplished this?
Comment
Watch Question

Commented:
Try this instead:
function wc_remove_image_effect_support() {
    remove_theme_support( 'wc-product-gallery-zoom' );
}
add_action( 'after_setup_theme', 'wc_remove_image_effect_support', 100 );

Open in new window

Alicia St RoseOwner & Principle Developer/Designer
CERTIFIED EXPERT

Author

Commented:
Hi @Dzynit,

I'd tried that one, too, to no avail. I just stumbled across a gem in the comments on this post:

https://businessbloomer.com/woocommerce-disable-zoom-gallery-slider-lightbox-single-product/#comments

And this worked:

"If you have an unsupported theme this code doesn’t work – I used a snippet I found here:

https://github.com/woocommerce/woocommerce/issues/18131"

// disable the magnification zoom in product images
add_action( 'template_redirect', function() {
    remove_theme_support( 'wc-product-gallery-zoom' );
}, 100 );

Open in new window

It's the template_redirect part. I'm using a custom theme I built using Underscores which might explain why the code I've been using didn't work. This info is SO needed across the web. So many folks can't turn it off.

Now, I need to make sure images don't open in new window when clicked...

Commented:
Glad you found a solution. I don't know why woocom removed it from the appearance > customizer area - there used to be a checkbox to turn the zoom on and off.
Owner & Principle Developer/Designer
CERTIFIED EXPERT
Commented:
And this worked:

"If you have an unsupported theme this code doesn’t work – I used a snippet I found here:

https://github.com/woocommerce/woocommerce/issues/18131"

// disable the magnification zoom in product images
add_action( 'template_redirect', function() {
    remove_theme_support( 'wc-product-gallery-zoom' );
}, 100 );

Open in new window


Select all
 
Open in new window

It's the template_redirect part. I'm using a custom theme I built using Underscores which might explain why the code I've been using didn't work. This info is SO needed across the web. So many folks can't turn it off.

Now, I need to make sure images don't open in new window when clicked...