As you know guys, WooCommerce comes with a bunch of features but some of them not required to keep and might clients don’t want to keep as it is. In this article, we will see how in WooCommerce disable zoom, lightbox, and gallery slider. Let’s see how to do it.
01 Disable WooCommerce Product Zoom In Single Page
In older version of WooCommerce didn’t provide inbuilt zoom functionality for a single product but in the latest version WooCommerce providing it as a default functionality. Add the following code snippet in your child theme’s function.php file to disable it.
add_action( 'after_setup_theme', 'scratchcode_disable_wc_zoom', 20 );
function scratchcode_disable_wc_zoom() {
remove_theme_support( 'wc-product-gallery-zoom' );
}
02 Disable WooCommerce Product Gallery Slider In Single Page
add_action( 'after_setup_theme', 'scratchcode_disable_wc_gallery_slider', 20 );
function scratchcode_disable_wc_gallery_slider() {
remove_theme_support( 'wc-product-gallery-slider' );
}
03 Disable WooCommerce Product Lightbox In Single Page
add_action( 'after_setup_theme', 'scratchcode_disable_wc_lightbox', 20 );
function scratchcode_disable_wc_lightbox() {
remove_theme_support( 'wc-product-gallery-lightbox' );
}
04 Disable All Together
add_action( 'after_setup_theme', 'scratchcode_disable_wc_lightbox_zoom_slider', 20 );
function scratchcode_disable_wc_lightbox_zoom_slider() {
remove_theme_support( 'wc-product-gallery-zoom' );
remove_theme_support( 'wc-product-gallery-lightbox' );
remove_theme_support( 'wc-product-gallery-slider' );
}
Where To Add This Snippet?
Most Important: Add the following code to your child theme’s functions.php file. If you add custom code directly to your parent theme’s functions.php file then it will be wiped entirely when you update the theme.
If you are using a custom theme and if it doesn’t require any update then you can directly place the code into wp-content/themes/your-theme/function.php file.
Please also note that we have tested all codes in the GeneratePress child theme & Storefront child theme.
Additionally, read our guide:
- How to Add Products Per Page Dropdown in WooCommerce
- “Sorry, your session has expired. Return to homepage” – WordPress WooCommerce Error
- How to Create a Plugin in WordPress from Scratch
- How to Disable Admin Bar in WordPress Without Plugin
- How to Rollback WordPress Plugin Update
- How To Send Custom Emails in WordPress
That’s it for now. We hope this article helped you WooCommerce disable zoom, lightbox, and gallery slider in a single product page.
Please let us know in the comments if everything worked as expected, your issues, or any questions. If you think this article saved your time & money, please do comment, share, like & subscribe. Thank you in advance 🙂
i like this superb article
We are glad that you like our articles. Thank you 🙂
I found your weblog web site on google and test just a few of your early posts. Proceed to maintain up the excellent operate. I just further up your RSS feed to my MSN News Reader. Looking for ahead to reading more from you afterward!…
Great! Thank you 🙂