• Resolved despachotres

    (@despachotres)


    Hi,

    I have another lightbox (foobox) plugin running in my sites, and woocommerce comes with it’s own built-in lightbox functionallity.

    Is there a way to “override” the woocommerce’s lightbox feature to use my plugin? (Disabling lightbox in woocommerce doesn’t work for this purposes).

    Thanks.

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    You need to first disable our lightbox and save settings and then add some JS code to your theme I believe, to trigger your custom lightbox when one of our images are clicked. You’ll need to check foobox docs to see how this is done and what code you need.

    Thread Starter despachotres

    (@despachotres)

    Thanks. I’m in contact with FooBox team. Let’s see if we can address this issue.

    Little Package

    (@littlepackage)

    Tip for Despachotres:

    You can disable/replace the current (prettyphoto) lightbox in plugins/woocommerce/woocommerce.php by adjusting the lines following this line

    if ( $lightbox_en && ( is_product() || ( ! empty( $post->post_content ) && strstr( $post->post_content, '[product_page' ) ) ) ) {

    I know I know, don’t adjust the core code… In which case you can do the same thing using code in your theme’s functions.php.

    anonymized-11892634

    (@anonymized-11892634)

    Very nearly what I need!

    Can anyone recommend what would need to be added to functions.php to disable prettyphoto?

    Thread Starter despachotres

    (@despachotres)

    Hi @pipdlg,

    I have unchecked the “Enable Lightbox” in Woocommerce configuration (general settings page). Then, you have to target the images to show up with your lightbox plugin.

    In my case, with Foobox, in WordPress single install it just works after deactivating lightbox in Woocommerce. In multisite, I have to address the “.images” class for the plugin to catch it. This is something the developers of Foobox (http://getfoobox.com) addressed very fast.

    Hope it helps.

    anonymized-11892634

    (@anonymized-11892634)

    Did a bit more digging and managed to piece together the following:

    add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
    
    function my_deregister_javascript() {
    	wp_deregister_script( 'prettyPhoto' );
    	wp_deregister_script( 'prettyPhoto-init' );
    	wp_deregister_script( 'woocommerce_prettyPhoto_css' );
    }

    I think that’ll do it? not sure if there is anything else which needs deregistering.

    anonymized-11892634

    (@anonymized-11892634)

    Just noticed that the last one should in fact be wp_deregister_style

    add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
    
    function my_deregister_javascript() {
    	wp_deregister_script( 'prettyPhoto' );
    	wp_deregister_script( 'prettyPhoto-init' );
    	wp_deregister_style( 'woocommerce_prettyPhoto_css' );
    }
    anonymized-11892634

    (@anonymized-11892634)

    …OK I think I’ve got it now!

    Please correct me if this is wrong?

    //DISABLE WOOCOMMERCE PRETTY PHOTO SCRIPTS
    add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
    
    function my_deregister_javascript() {
    	wp_deregister_script( 'prettyPhoto' );
    	wp_deregister_script( 'prettyPhoto-init' );
    }
    
    //DISABLE WOOCOMMERCE PRETTY PHOTO STYLE
    add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
    
    function my_deregister_styles() {
    	wp_deregister_style( 'woocommerce_prettyPhoto_css' );
    }
    anonymized-11892634

    (@anonymized-11892634)

    Just noticed your reply @despachotres

    Did NOT realise there was an option to disable lightbox in the UI! That would haev saved me some time here.

    ha, thanks 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Replacing woocommerce lightbox’ is closed to new replies.