Support » Plugin: WooCommerce » WooCommerce Disable LightBox

Viewing 5 replies - 1 through 5 (of 5 total)
  • I just figured this out for myself. First, I’m using the “Lightbox Plus ColorBox” plugin and I want all of my Lightboxes to look the same. I accomplished this by overriding the default woocommerce theme, documented here:

    1. Copy the file




    2. Notice the “templates” directory is missing from the destination path which contradicts the documentation in the link above. This is intentional because the documentation above is incorrect, see here:
    3. Edit product-image.php in the new location. Find this line:

      echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" title="%s" rel="prettyPhoto' . $gallery . '">%>%s</a>', $image_link, $image_title, $image ), $post->ID );

      It’s near the bottom. Change this line to:

      echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" title="%s" rel="lightbox[]"%s</a>', $image_link, $image_title, $image ), $post->ID );

    Badda bing badda boom. This method will prevent your changes from being overwritten if you upgrade WooCommerce in the future.

    Mike S.

    Roy Ho


    Thanks for contributing and helping others. However I would suggest you don’t even copy the template file but instead use the filters you already see there.

    I don’t know what you are talking about I guess, but I’m glad you posted because it caused me to look at my post again and I found an error.

    Here is the correction, I missed a character in the override version of the code, it should be:

    echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" title="%s" rel="lightbox[]">%s</a>', $image_link, $image_title, $image ), $post->ID );

    Roy Ho


    Please have a look at the WordPress Codex on how to use filters.

    Thanks, this solved my problem as well.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WooCommerce Disable LightBox’ is closed to new replies.