How to Disable WooCommerce Zoom & Lightbox

If you’ve ever set up a WooCommerce store, you know the product image gallery comes with a few “fancy” features out of the box: zoom on hover, click-to-open lightbox, and sometimes even a slider.

That’s great for some shops, but maybe not for everyone. Imagine a customer zooming in so far they can see the pixels on Santa’s beard… or worse, they click an image and get whisked away to a giant file instead of focusing on your “Add to Cart” button. Ho-ho-no, thank you!

Today’s snippet is a way to disable zoom and lightbox so your product images behave nicely. But why might you want this? For some stores — especially ones with printables, digital downloads, or themed items (hello, Christmas merch!) — zoom and lightbox add little value. Keeping product pages simple, quick, and distraction-free can boost conversions.

Just paste the following snippet into your functionality plugin or in your theme’s functions file – or you could even make it a stand-alone plugin.

/**
 * WooCommerce: Disable zoom, lightbox, and click-to-file
 */

add_action( 'after_setup_theme', function () {
    if ( function_exists( 'is_woocommerce' ) ) {
        // Turn off zoom on hover
        remove_theme_support( 'wc-product-gallery-zoom' );
        // Turn off lightbox popup
        remove_theme_support( 'wc-product-gallery-lightbox' );
    }
}, 100 );

// Extra safeguard to disable Photoswipe lightbox
add_filter( 'woocommerce_single_product_photoswipe_enabled', '__return_false' );

// Remove anchor tags around main product image + thumbnails
function disable_wc_product_image_links( $html ) {
    return preg_replace( '#<a[^>]*>(.*?)</a>#is', '$1', $html );
}
add_filter( 'woocommerce_single_product_image_html', 'disable_wc_product_image_links', 10 );
add_filter( 'woocommerce_single_product_image_thumbnail_html', 'disable_wc_product_image_links', 10 );

// Optional CSS fallback (in case a theme forces links with JS)
add_action( 'wp_head', function () {
    if ( function_exists( 'is_product' ) && is_product() ) {
        echo '<style>
            .woocommerce-product-gallery__image a,
            .woocommerce-product-gallery__trigger {
                pointer-events: none !important;
                cursor: default !important;
                display: none !important;
            }
        </style>';
    }
});

What This Snippet Does

🚫 No zooming in on product images (Santa’s pores remain a mystery).

🚫 No lightbox popup distracting shoppers from checkout.

🚫 No click-to-file, so visitors won’t get lost in a giant JPEG.

✅ Leaves you with a clean, static product gallery.

Use this WooCommerce snippet to disable product image zoom and remove the lightbox, creating a distraction-free product gallery that’s perfect for holiday shoppers. Happy coding, and may your WooCommerce shop be merry, bright, and free of unnecessary zooms!

Leave a Reply

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