You are currently viewing How to enable WooCommerce Lightbox support in the theme

How to enable WooCommerce Lightbox support in the theme

Prior to version 3.0, WooCommerce used lightbox support on the product detail page by default. It is used to show the product gallery in a lightbox pop-up to zoom the image. Many themes which are developed and launched before August 2017, either use their own built-in zoom or pop-up scripts or they use the WooCommerce built-in lightbox.

In this case, if you have the theme which was using WooCommerce default lightbox. And you are not able to get the theme updates or theme stopped releasing updates or the theme didn’t fix the issue yet in any update then here is a solution for you.

Open a file functions.php in /wp-content/themes/{YOUR-THEME}/functions.php
and paste the following code at the end of the file ( where “YOUR-THEME” will be the active theme in your WordPress installation ).

add_action( 'after_setup_theme', 'mytheme_after_setup_theme');
function mytheme_after_setup_theme() {
    add_theme_support('wc-product-gallery-lightbox');
}

Also, the current theme must add the support for WooCommerce add_theme_support('woocommerce') else the code above won’t work. If the code above doesn’t work as expected then try adding the line add_theme_support('woocommerce') above the add_theme_support('wc-product-gallery-lightbox') line.

George

Welcome to Wptech. If you’re in search of creative front-end or back-end developer with other creative pros, you’ll find it here. We assemble stylish, Onepage, Multipage, Fully responsive, completely useful Websites and Plugins.

Leave a Reply