Site logo

Archived topic

Disable Woo product images linking to gallery page

6 replies · Started by John on May 21, 2019

Viewing posts 1–7 of 7

This seems like it should be incredibly simple and obvious, but I've thought and looked and googled and I'm clearly just missing something somewhere.

I have created some products in WooCommerce and added product images (see attached image).

Images display as they should, clicking one makes it the main (bigger) image and mouseover zooms. All great.

What I also have and don't want is a zoom icon on the top right of main image which clicks through to a separate gallery page.

I would like to disable this, but it doesn't seem obvious how.

I know I can just hide it with css using display: none; but surely there is a better solution, what am I missing?

Thanks Leo but that function doesn't do exactly what I am looking for.

If I use that function then I get rid of the magnifying glass but clicking anywhere on the image takes me to a popup gallery page and I lose the rollover zoom functionality.

What I want is to keep the images with rollover zoom but get rid of the link to the 'gallery' so that you see and can zoom on the images on the product page but there is no clickable link (the magnifying glass) to take you away from the product page.

What I want to get rid of is this:

<a href="#" class="woocommerce-product-gallery__trigger"><img draggable="false" class="emoji" alt="🔍" src="https://s.w.org/images/core/emoji/12.0.0-1/svg/1f50d.svg"></a>

But without making the entire image then turn into a link to the gallery.

Yep, this function does pretty much exactly what I was looking for.

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

Excellent, thanks.

Glad we could be of help

This archived topic is closed to new replies.