If you’ve ever used WooCommerce, you know that it’s a great platform for setting up an online store. It’s easy to use and has a lot of features that make it a great choice for online businesses. One of the things that makes WooCommerce so great is its ability to zoom in on images.
This feature is great for product photos, but it can be a bit annoying if you’re trying to view other images on the site. There are a few ways to disable the image zoom feature in WooCommerce, and we’ll cover them all in this article.
The first way to disable image zoom is to go to the WooCommerce settings page and uncheck the “Enable Image Zoom” option. This will disable image zoom for all products on your site.
If you only want to disable image zoom for certain products, you can do so by going to the product page and unchecking the “Enable Image Zoom” option. This will only disable image zoom for that particular product.
The second way to disable image zoom is to add the following code to your theme’s functions.php file:
add_filter( 'woocommerce_single_product_image_zoom_enabled', '__return_false' );
This code will disable image zoom for all products on your site. If you only want to disable image zoom for certain products, you can do so by adding the following code to your theme’s functions.php file:
add_filter( 'woocommerce_single_product_image_zoom_enabled', 'my_custom_product_image_zoom' );
function my_custom_product_image_zoom( $zoom ) {
// replace 'your-product-id' with the id of your product
if ( is_product('your-product-id') ) {
$zoom = false;
}
return $zoom;
}
The third way to disable image zoom is to add the following code to your theme’s functions.php file:
function mytheme_setup() {
remove_theme_support( 'wc-product-gallery-zoom' );
}
add_action( 'after_setup_theme', 'mytheme_setup' );
Conclusion:
There are a few different ways that you can disable the image zoom feature in WooCommerce. You can either go into the settings and uncheck the “Enable Image Zoom” option, or you can add some code to your theme’s functions.php file. If you only want to disable image zoom for certain products, you can do so by adding some code to your theme’s functions.