WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
WooCommerce Disable LightBox (6 posts)

  1. jazel.d@gmail.com
    Member
    Posted 1 year 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! :)

    Cheers,
    //Dmitrij

    http://wordpress.org/extend/plugins/woocommerce/

  2. mssteinke
    Member
    Posted 12 months 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

      wp-content/plugins/woocommerce/templates/single-product/product-image.php

      to:

      wp-content/themes/THEME-NAME/woocommerce/single-product/product-image.php

    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
    Member
    Posted 12 months 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
    Member
    Posted 12 months 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
    Member
    Posted 12 months ago #

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

  6. bjornaerts
    Member
    Posted 6 months ago #

    Thanks, this solved my problem as well.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic