How to Disable WooCommerce Lightbox/Hover zoom ?

If you’re having troubles removing default WooCommerce LightBox or Image Magnifier, on your product page, don’t worry. I have got the perfect solution for you.

For starters, you will need to paste this snippet into your functions.php file, within the theme folder:

remove_theme_support( 'wc-product-gallery-zoom' );

The function of this code will remove the “image zoom” feature on the single product page.

In case you don’t know, WooCommerce Lightbox is a product feature that lets you open the image gallery with just a click.

This feature comes in handy if you are selling products that your customers would want to have a clear view of the product image.

But you don’t want this feature, and you want it disabled, right?

Not a problem… All you have to do is to add the following code in theme’s functions.php

add_action( 'after_setup_theme', 'remove_wc_gallery_lightbox', 100 );
function remove_wc_gallery_lightbox() {
remove_theme_support( 'wc-product-gallery-lightbox' );
}

And boom! The product image will automatically disable LightBox or Image Magnifier.

Here’s how the page looks like before the code:

And here’s the image after the code:

Pro tip: Make sure you use only the child theme for all customization on your site. This theme will prevent you from losing all the changes in your store after theme update.

So, what’s your experience using this code? Do you have other ways to do it? Let me know in the comments. We’d love to hear from you.

Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

Leave a Comment

Your email address will not be published. Required fields are marked *