New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable single product image effects #18131

Closed
paaljoachim opened this Issue Dec 13, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@paaljoachim

paaljoachim commented Dec 13, 2017

The case.

WooCommerce -> Settings -> Display
there should be a disable box for zoom, gallery and lightbox. Then a checkbox for turn off all effects making the single product image non clickable.

As one might have a good enough image as it is without the need for any extra effects going on with the single product image.

Today I have used the code from here to disable each of the areas:
https://businessbloomer.com/woocommerce-disable-zoom-gallery-slider-lightbox-single-product/

but it still leaves the image clickable. It is just a temporary solution.

@kloon

This comment has been minimized.

Member

kloon commented Dec 13, 2017

This functionality is dependant on if a theme adds support for it. We add support for the default themes due to the nature of the product page layout, however, you can disable it by using this code

add_filter( 'current_theme_supports-wc-product-gallery-zoom', '__return_false' );
add_filter( 'current_theme_supports-wc-product-gallery-slider', '__return_false' );
add_filter( 'current_theme_supports-wc-product-gallery-lightbox', '__return_false' );

@kloon kloon closed this Dec 13, 2017

@kloon kloon added the invalid label Dec 13, 2017

@paaljoachim

This comment has been minimized.

paaljoachim commented Dec 13, 2017

Hi Gerhard

Thanks, but the code you shared did not work for me.
I have been using the below code.

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

I have also been looking at https://www.worcesterwebstudio.com/remove-link-product-image-woocommerce/ to remove the link from the single product image. So it is not clickable. It would be great to get this working. I can then share it multiple places so that others can also benefit from figuring out how to turn off zoom/slider/lightbox and clickable image. (It sounds like this will not be added directly to WooCommerce.)

@paaljoachim

This comment has been minimized.

paaljoachim commented Dec 17, 2017

It would be great to have these code snippets added to https://docs.woocommerce.com/documentation/plugins/woocommerce/woocommerce-codex/snippets/general-snippets/

As disabling the zoom/slider/lightbox and clickable link directly in the product page is something that is useful for a lot of people.

@paaljoachim

This comment has been minimized.

paaljoachim commented Dec 18, 2017

Btw I suddenly noticed I do not need the code any longer as today one has to instead add the code:
https://woocommerce.wordpress.com/2017/02/28/adding-support-for-woocommerce-2-7s-new-gallery-feature-to-your-theme/

BUT the featured image in the single product page is still clickable.

@paaljoachim

This comment has been minimized.

paaljoachim commented Dec 18, 2017

Bottom line:
zoom/slider and lightbox has been removed and one has to use code to reinsert it. To remove the clickable single product featured image one can use:

.woocommerce div.product div.images .woocommerce-product-gallery__wrapper {
    pointer-events: none;
}
@donnamcmaster

This comment has been minimized.

donnamcmaster commented May 26, 2018

Neither of the above methods worked for me. I have an unsupported theme, so WC is helpfully enabling the gallery options for me. A review of the WC code showed that the function where they are being enabled is called on the template_redirect hook at default priority.

So I tried this and it works:

// disable the magnification zoom in product images
add_action( 'template_redirect', function() {
    remove_theme_support( 'wc-product-gallery-zoom' );
    remove_theme_support( 'wc-product-gallery-lightbox' );
    remove_theme_support( 'wc-product-gallery-slider' );
}, 100 );
@adampatterson

This comment has been minimized.

adampatterson commented Jul 10, 2018

I am having the same issue Since Woo 3.4 does not require custom themes anymore and will load through the the_content I can't disable the lightbox or the photo zoom.

I did try what @donnamcmaster suggested and it worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment