For those of you who remember the little check box on the Woocommerce display settings page, well if you haven’t looked for a while, it is no longer there to make you feel warm and fluffy.
You may have noticed that your light box functionality stopped working inexplicably and found a work around or installed yet another random plugin to account for the loss of functionality. That may or may not have been a mistake, because the powers-that-be within Woocommerce simply decided to allow theme builders to adjust which functions they want their users to experience.
If you miss the features, or your light box “plugin” solution is a little bloated then all you need to do is tell Woocommerce that your theme is more than happy to have the more “pretty” gallery options enabled.
Find your theme’s function.php and add the following code to the end of it and “Robert will be your Mother’s brother”, your lovely Woocommerce product galleries will look absolutely awesome once more and your visitors will no longer have to click the back button to return to your site that hopefully makes you money.
[php]
// WEBDAV Function for adding the Woocommerce Gallery
// functionality to a WORDPRESS and WOOCOMMERCE e-commerce
// solution.
//
// This code is provided Copyright free, please use at will
// where required. It would be appreciated if this message
// was included with your use of the code.
//
// Author: Dave Wise @ https://webdav.incredulous.org
//
add_action( ‘after_setup_theme’, ‘webdav_woocommerce_gallery_setup’ );
function webdav_woocommerce_gallery_setup() {
add_theme_support( ‘wc-product-gallery-zoom’ );
add_theme_support( ‘wc-product-gallery-lightbox’ );
add_theme_support( ‘wc-product-gallery-slider’ );
}
[/php]
It is important to remember, if you’re running a WordPress cache plugin then it is highly likely you will need to flush the css/js cache in order for the changes to become visible and for your world to be all happy and light.
Enjoy your pretty new Woocommerce Gallery.
Leave a Reply