How to fix your broken lightbox and photo gallery after woocommerce 3.0 update

May 16, 2018

If you’re experiencing a broken photo gallery and your lightbox has gone missing after upgrading to WooCommerce 3.0 don’t fret I’ve got you! Read on.

This is a significant frontend change that can be broken down in to three separate new features;

  • Image zoom / magnification
  • Lightbox
  • Slider

To enable each of these features in your theme you must declare support using add_theme_support() like so;

 

1
2
3
4
5
6
7
add_action( 'after_setup_theme', 'yourtheme_setup' );
 
function yourtheme_setup() {
    add_theme_support( 'wc-product-gallery-zoom' );
    add_theme_support( 'wc-product-gallery-lightbox' );
    add_theme_support( 'wc-product-gallery-slider' );
}

 

This allows you the flexibility to pick and choose exactly which features you want to include/exclude in your theme or at your store. This code is added to your themes function.php file. If you are not comfortable editing your themes function.php file then you can download this plugin: https://wordpress.org/plugins/my-custom-functions/ and simply copy and paste the above code into the plugins settings.

 

 

 

Article source: https://woocommerce.wordpress.com