Disable zoom, the lightbox, or the slider in WooCommerce’s classic product gallery. You can remove only the features your theme does not need.
Note:
This is a Developer level doc. If you are unfamiliar working with code and resolving potential conflicts, we recommend you work with a Woo Agency Partner for larger projects, or find a WooCommerce developer on Codeable for smaller customizations. We are unable to provide support for customizations under our Support Policy.
Before you start
↑ Back to top- A staging site with a backup and a way to restore theme files if PHP fails.
- An active child theme, or a theme you maintain, and access to its
functions.phpfile. Do not edit WooCommerce or a third-party parent theme. - A classic theme that already declares WooCommerce support. See the classic theme developer handbook for theme integration.
- A product with a featured image and at least two gallery images for testing.
This example targets the classic WooCommerce product gallery in a WooCommerce-supporting classic theme. It does not control the newer Product Gallery block or a gallery supplied by another plugin. Unsupported themes and block themes can add gallery support through a different path; do not use this example as a universal gallery switch.
Disable the selected features
↑ Back to top- In your theme’s
functions.php, add the following callback inside the existing PHP section. Do not add a second PHP opening tag. - Keep only the
remove_theme_support()lines for the features you want to disable. For example, delete the slider line if customers should still navigate gallery images with the slider. - Save the file and clear any page cache before opening the test product.
/**
* Disable WooCommerce's classic product gallery features.
*/
function mytheme_disable_product_gallery_features() {
remove_theme_support( 'wc-product-gallery-zoom' );
remove_theme_support( 'wc-product-gallery-lightbox' );
remove_theme_support( 'wc-product-gallery-slider' );
}
add_action( 'after_setup_theme', 'mytheme_disable_product_gallery_features', 100 );
The callback runs on after_setup_theme at priority 100, after theme callbacks using the default priority of 10. Check your parent theme’s setup code: if it enables these features later, run your callback after that specific callback.
Removing zoom prevents WooCommerce’s hover zoom. Removing lightbox prevents its PhotoSwipe viewer; an image link may still open the image directly. Removing the slider changes how gallery images are displayed and navigated, so check that customers can still reach every image.
Verify the gallery
↑ Back to top- Open the test product on desktop and a narrow screen. Hover over its main image, select the image, and navigate the gallery.
- Confirm each feature you removed is disabled, each feature you kept still works, and all product images remain accessible.
- Repeat on a variable product and select a variation with its own image. Check that the displayed image updates correctly.
If the result is unexpected
↑ Back to topIf a feature remains active, confirm the product uses the classic gallery, then check for a later theme callback, a gallery replacement, or a filter overriding WooCommerce’s gallery parameters. Changing a support flag does not disable another plugin’s gallery.
If navigation breaks or the site reports a PHP error, restore the previous file using your file manager or deployment tool. To undo a working customization, remove this callback and its add_action() line, clear the page cache, and repeat the gallery checks.
For image management and block-gallery controls, see Adding Product Images and Galleries.