• Resolved richardu

    (@richardu)


    Is there a setting that will allow me to disable the lightbox for Woocommerce single products?

    Thanks, Richard

Viewing 11 replies - 1 through 11 (of 11 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    Try adding this function:

    add_action( 'after_setup_theme', 'tu_disable_wc_lightbox', 20 );
    function tu_disable_wc_lightbox() {
        remove_theme_support( 'wc-product-gallery-lightbox' );
    }

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    Let me know ??

    Thread Starter richardu

    (@richardu)

    I added that with Code Snippets and I’m still getting the lightbox. Would it matter that my featured images are .svg format? In fact, the lightbox that pops up is just a black screen because the .svgs are not showing.

    Richard

    Theme Author Tom

    (@edge22)

    I don’t think that should make a difference, but it may be something to ask WooCommerce.

    Can you try this function instead?:

    add_action( 'wp', 'tu_disable_wc_lightbox', 20 );
    function tu_disable_wc_lightbox() {
        remove_theme_support( 'wc-product-gallery-lightbox' );
    }
    Thread Starter richardu

    (@richardu)

    This function does not open a lightbox, but it navigates to the native location of the image used: e.g. https://mydomain.com/wp-content/uploads/2018/05/logo.svg

    That’s actually an improvement since the default behavior turns the screen black. But it’s not exactly what I would like which is for clicking on the featured image to do nothing. I’ll be happy to test anything else you like.

    Cheers, Richard

    Theme Author Tom

    (@edge22)

    Would it be better if the images didn’t link anywhere at all?

    Thread Starter richardu

    (@richardu)

    Exactly. That’s what I am aiming for. Sorry if I was not clear.

    Thanks.

    Theme Author Tom

    (@edge22)

    I wonder if something like this might work?: https://gist.github.com/rynaldos/0a54362495c35a1850e80234350d2d5a

    Thread Starter richardu

    (@richardu)

    Works perfectly. Thought I needed to attack this with theme specific input. Thanks, Richard

    Theme Author Tom

    (@edge22)

    No problem ??

    So, to piggyback on this, how would you link the image to an affiliate link or other link?

    Theme Author Tom

    (@edge22)

    I’m not sure if it’s possible to change the link itself. Might be worth asking WooCommerce support.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Disable Lightbox for Woocommerce Products’ is closed to new replies.