WooCommerce Disable LightBox (6 posts)

  1. jazel.d@gmail.com
    Posted 3 years ago #

    Hello guys,

    new to WooCommerce here, I wanted to ask if it is possible somehow disable standard WooCommerce LightBox and use FancyBox JQuery pluggin instead?

    Thanks for help! :)



  2. mssteinke
    Posted 3 years ago #

    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: http://docs.woothemes.com/document/template-structure/.

    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: http://wordpress.org/support/topic/woocommerce-override-theme-files-doesnt-work?replies=12
    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.

  3. Roy Ho
    Posted 3 years ago #

    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.

  4. mssteinke
    Posted 3 years ago #

    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 );

  5. Roy Ho
    Posted 3 years ago #

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

  6. bjornaerts
    Posted 2 years ago #

    Thanks, this solved my problem as well.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic