Avatar of Alicia St Rose
Alicia St Rose
Flag for United States of America asked on

Need to disable Hover Zoom on Single product pages in WooCommerce

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?
E-CommerceWordPress

Avatar of undefined
Last Comment
Alicia St Rose

8/22/2022 - Mon
Heather Ritchey

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 Rose

ASKER
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...
Heather Ritchey

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.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
Alicia St Rose

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.