The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Disable WooCommerce Product Image Lightbox

Shared by Amit Dholiya · August 27, 2026 · @after_setup_theme

2 copies
37 views
1 upvote
Back to Snippets

WooCommerce includes a lightbox that opens product images in a larger view when customers click them. If you prefer a simple product gallery without the popup, you can disable it with a small snippet.

Steps

  1. Open your theme’s functions.php file.
  2. Add the code below.
  3. Save the file.
  4. Clear your website cache and refresh the product page.

Done — the WooCommerce product image lightbox will be disabled.

function disable_woocommerce_image_lightbox() {
    remove_theme_support( 'wc-product-gallery-lightbox' );
}

add_action(
    'after_setup_theme',
    'disable_woocommerce_image_lightbox',
    100
);
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments