Disable Zoom on WooCommerce Product Images

Tags: WooCommerce
add_action( 'wp', function() {
    // Remove the zoom functionality
    remove_theme_support( 'wc-product-gallery-zoom' );
    
    // Remove the link to the product image
    add_filter( 'woocommerce_single_product_image_thumbnail_html', function( $html ) {
        return preg_replace( '/<a[^>]*>(.*?)<\/a>/i', '$1', $html );
    }, 10 );
});

How to Disable the Zoom Effect for Product Images

Copy the PHP code snippet to your clipboard. Paste the snippet to your functions.php file and press Update File.

For using a Code Snippets Manager: paste the code into a PHP file and assign the title (Disable Image Zoom) and save your file.

Optional: consider setting a condition for applying this only Single Products, so the code is not executed across every page of your website.

Why Disable Image Zoom for Products?

If your products are not displaying high-quality, high-resolution imagery, then the product zoom effect does not serve its purpose and can actually make your products look worse when zoomed in.