• Resolved stefanies

    (@stefanies)


    Hello everyone,

    I’m new to this forum and would really appreciate your help πŸ™‚

    I’m trying to find a way to disable the zoom function WITHIN the Lightbox (single product page). I do NOT want to disable the Lightbox completely.

    So the lightbox should open when the magnifier glass is clicked, but there shouldn’t be the possibility of zooming in further when the Lightbox is active/open.

    Any ideas on how I could achieve this?

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • mother.of.code

    (@imazed)

    The Mother of Code

    Hi there! You can disable zoom like this:

    add_action( 'after_setup_theme', 'woo_remove_zoom_lightbox_theme_support', 99 );
     
    function woo_remove_zoom_lightbox_theme_support() { 
    remove_theme_support( 'wc-product-gallery-zoom' );
    }

    This will leave the lightbox intact. This bit of code needs to go into your functions.php file.

    Thread Starter stefanies

    (@stefanies)

    Thank you very much for the quick response!

    I’ve tried it, but now it opens a second Lightbox on top of the initial Lightbox XD

    After entering the code in the functions.php file, this is what happens when I click the image on the single product page:

    Two lightboxes open on top of each other, whereas the “new” one is on top of the “old” one. But you can see the old one through as the Lightbox on the top is a little bit transparent and the image which is shown in the Lightbox below is larger.

    when I try to close the Lightbox: the “new” Lightbox, which is on top closes, but the Lightbox underneath gets visible now and the image is zoom-able. I have tho close both lightboxes individually to get back to the single product page.

    Any idea on how to fix this? πŸ™‚

    Thread Starter stefanies

    (@stefanies)

    Ok, I’ve managed to fix the problem with the two lightboxes with this code:

    add_action( 'after_setup_theme', 'remove_wc_gallery_lightbox', 100 );
    function remove_wc_gallery_lightbox() {
    remove_theme_support( 'wc-product-gallery-lightbox' );
    }
    
    add_action( 'after_setup_theme', 'woo_remove_zoom_lightbox_theme_support', 99 );
    
    function woo_remove_zoom_lightbox_theme_support() { 
    remove_theme_support( 'wc-product-gallery-zoom' );
    }

    When I click the image on the single product page the Lightbox opens and the image there is not zoom-able. So far so good. πŸ™‚

    What I’m missing now is the following:
    1. the gallery slider within the lightbox disappeared (there are no arrows to click through the gallery)
    2. The default zoom-on-hover-feature on the single product page is gone which I would love to enable again

    How can I reenable the zoom-on-hover-feature on the single product page and the gallery slider in the lightbox?

    Jesse Pearson (a11n)

    (@jessepearson)

    Automattic Happiness Engineer

    @stefanies This sounds like it is most likely an issue with the theme you are using. I used the code below with TwentySeventeen and I didn’t have any issues, the zoom feature was removed and the lightbox worked correctly.

    
    add_action( 'after_setup_theme', 'woo_remove_zoom_lightbox_theme_support', 99 );
    function woo_remove_zoom_lightbox_theme_support() { 
    	remove_theme_support( 'wc-product-gallery-zoom' );
    }
    
    Jesse Pearson (a11n)

    (@jessepearson)

    Automattic Happiness Engineer

    @stefanies We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Enable Lightbox but disable zoom within the Lightbox’ is closed to new replies.