WordPress filter hook

woocommerce_single_product_image_thumbnail_html

Defined by WooCommerce and fired by 65 plugins in total, running on 7.3M+ sites between them.

“Filter product image thumbnail HTML string.”

How to use woocommerce_single_product_image_thumbnail_html

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_single_product_image_thumbnail_html', function( $html, $post_thumbnail_id ) {
	// Change $html here.
	return $html;
}, 10, 2 );

Argument names come from Jupiter X Core's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

65 plugins that fire woocommerce_single_product_image_thumbnail_html

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $first_media_id ) templates/single-product/product-image.php:88
  2. ShopLentor icon ShopLentor80,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $thumbnail_id ) classes/class.default_data.php:358
  3. Jupiter X Core icon Jupiter X Core70,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) includes/extensions/raven/includes/modules/product-gallery/module.php:234
  4. DethemeKit for Elementor icon DethemeKit for Elementor30,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) includes/quickview-content.php:24
  5. Additional Variation Images Gallery for WooCommerce icon Additional Variation Images Gallery for WooCommerce30,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $attachment_id ) includes/class-woo-variation-gallery-frontend.php:860
  6. Product Gallery Slider, Additional Variation Images for WooCommerce icon Product Gallery Slider, Additional Variation Images for WooCommerce20,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) includes/class-variation-images.php:243
  7. Thim Elementor Kit icon Thim Elementor Kit20,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) inc/elementor/widgets/single-product/product-image.php:614
  8. Product Video Gallery for Woocommerce icon Product Video Gallery for Woocommerce10,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', '<div title="video" class="nswiper-slide nickx-thumbnail video-thumbnail"><img ' . $hwstring . ' data-skip-lazy="true" ' . $global_thumb . ' src="' . esc_url( $product_video_thumb_url ) . '" ' . $custom_thumbnail . ' class="product_video_img img_'.$key.' attachment-thumbnail size-thumbnail" alt="video-thumb-'.$key.'"><svg class="video_icon_img" xmlns="http://www.w3.org/2000/svg" width="60" heig... ) public/class-rendering.php:423
  9. YITH WooCommerce Product Gallery & Image Zoom icon YITH WooCommerce Product Gallery & Image Zoom10,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<li class="%s" style="%s"><a href="%s" class="%s" title="%s" data-small="%s">%s</a></li>', $image_class, $li_style, $magnifier_url, $image_class, $image_title, $thumbnail_url, $image ), $attachment_id, $post->ID, $image_class, $columns ) templates/single-product/product-thumbnails-magnifier.php:78
  10. Variation Images Gallery for WooCommerce icon Variation Images Gallery for WooCommerce10,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', '<div class="rtwpvg-yith-badge"></div>', $product->get_image_id() ) app/Controllers/Hooks.php:213
  11. WPC Composite Products for WooCommerce icon WPC Composite Products for WooCommerce9,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', wc_get_gallery_image_html( $id ), $id ) includes/class-wooco.php:233
  12. 3D Viewer icon 3D Viewer9,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) inc/Woocommerce/SingleProduct.php:189
  13. Ibtana icon Ibtana5,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<li title="%s">%s</li>', esc_attr( $image_title ), wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_large_thumbnail_size', 'thumbnail' ), 0, $thumbnails_catlog ) ), $attachment_id, $post->ID ) inc/class-public.php:547
  14. Video Gallery for WooCommerce icon Video Gallery for WooCommerce4,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<div class="col vwg-variable" data-index="%d"><a>%s</a></div>', $index, $image ), $attachment_id, $post->ID, $image_class ) woocommerce-overwrite/templates/single-product/flatsome/product-gallery-thumbnails-flatsome-theme.php:163
  15. Really Simple Featured Video for Posts, Pages & WooCommerce Products icon Really Simple Featured Video for Posts, Pages & WooCommerce Products4,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) includes/Compatibility/Plugins/AstraPro/templates/woocommerce/single-product-gallery.php:165
  16. WooSwipe WooCommerce Gallery icon WooSwipe WooCommerce Gallery3,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', '1', $attachment_id ) public/class-wooswipe-public.php:326
  17. Kadence for WooCommerce and Elementor icon Kadence for WooCommerce and Elementor3,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, null ) inc/elementor-widgets/product-gallery.php:85
  18. Ultimate Store Kit icon Ultimate Store Kit3,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf('<a href="%s" class="%s" title="%s" >%s</a>', $image_link, $image_class, $image_caption, $image), $attachment_id, $post->ID, $image_class ) includes/helper.php:1239
  19. Advanced WooCommerce Product Gallery Slider icon Advanced WooCommerce Product Gallery Slider3,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<li title="%s">%s</li>', esc_attr( $props['caption'] ), wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_large_thumbnail_size', 'thumbnail' ), 0, $thumbnails_catlog ) ), $attachment_id, $post->ID ) inc/product-thumbnails.php:60
  20. Upsell Funnel Builder for WooCommerce icon Upsell Funnel Builder for WooCommerce2,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $image_id ) public/class-upsell-order-bump-offer-for-woocommerce-public.php:780
  21. Move Addons for Elementor icon Move Addons for Elementor2,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) includes/templates/quickview.php:26
  22. The Pack Elementor addon icon The Pack Elementor addon2,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $attachment_id ) includes/widgets/woocommerce/woo-quick-thumbnail/view.php:15
  23. Panorama icon Panorama2,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) inc/Woocommerce/ProductView.php:180
  24. VARGAL icon VARGAL1,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', wc_get_gallery_image_html( $attachment_id, false, $key ), $attachment_id ) templates/product-thumbnails.php:19
  25. WPB Quick View Popup for WooCommerce icon WPB Quick View Popup for WooCommerce1,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $attachment_id ) inc/wpb_wl_hooks.php:105
  26. Quick View For WooCommerce icon Quick View For WooCommerce1,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<a href="%s" class="%s" title="%s" >%s</a>', $image_link, $image_class, $image_caption, $image ), $attachment_id, $post->ID, $image_class ) classes/class.frontend.php:82
  27. WoowGallery icon WoowGallery1,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) includes/woocommerce/templates/product-image.php:100
  28. Book Previewer for Woocommerce icon Book Previewer for Woocommerce1,000+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) templates/product-image.php:63
  29. ThemeREX eCommerce Extensions for Elementor icon ThemeREX eCommerce Extensions for Elementor900+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', wc_get_gallery_image_html( $main_image_id, true ), $main_image_id ) core/modules/widgets/single-product-gallery/single-product-gallery-elementor-widget.php:2020
  30. WPC Additional Variation Images for WooCommerce icon WPC Additional Variation Images for WooCommerce800+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', wc_get_gallery_image_html( $id ), $id ) includes/class-frontend.php:77
  31. Product Badges For WooCommerce icon Product Badges For WooCommerce700+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) template/woocommerce/single-product/product-image.php:55
  32. ShopPress icon ShopPress600+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) Modules/QuickView.php:410
  33. Slider Ultimate icon Slider Ultimate500+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) woocommerce-templates/single-product/product-image.php:54
  34. StoreBuild icon StoreBuild400+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) public/class-pure-wc-shopbuild-compare.php:291
  35. WPA WooCommerce Product Gallery Slider Lite icon WPA WooCommerce Product Gallery Slider Lite300+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) templates/product-image.php:80
  36. XT Quick View for WooCommerce icon XT Quick View for WooCommerce300+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $single_image, $attachment_id ) public/templates/parts/product-slider.php:85
  37. Food Online for WooCommerce icon Food Online for WooCommerce300+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) templates/woocommerce/single-product/image/product-image.php:48
  38. Before After Slider for WooCommerce icon Before After Slider for WooCommerce100+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) inc/functions.php:229
  39. Woo Product Carousel and Zoom icon Woo Product Carousel and Zoom100+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<a href="'.esc_url( $props['url'] ).'" class="product-carousel" title="%s" data-standard="'.esc_url( $props['url'] ).'" data-image="'.esc_url( $props['url'] ).'">%s</a>', esc_attr( $props['caption'] ), wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ), 0, $props ) ), $attachment_id, $post->ID, esc_attr( $image_class ) ) woo-templates/single-product/product-thumbnails.php:66
  40. Shopready icon Shopready100+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', wc_get_gallery_image_html( $attachment_id ), $attachment_id ) src/extension/templates/tpl/single-product/product-thumbnails.php:16
  41. ShopMaker icon ShopMaker90+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) classes/widgets/sm-single-product-image.php:823
  42. AR for WooCommerce icon AR for WooCommerce50+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) templates/woocommerce/single-product/gallery-product-image.php:80
  43. Variation Swatches and Gallery for WooCommerce icon Variation Swatches and Gallery for WooCommerce30+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', wc_get_gallery_image_html( $attachment_id ), $attachment_id ) public/class-variation-swatches-and-gallery-public.php:178
  44. Really Simple Featured Audio icon Really Simple Featured Audio20+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) includes/Compatibility/Plugins/AstraPro/templates/woocommerce/single-product-gallery.php:64
  45. Zoom magnifier for Woocommerce icon Zoom magnifier for Woocommerce20+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<li class="%s"><a href="%s" class="%s" title="%s" data-small="%s">%s</a></li>', $image_class, $magnifier_url, $image_class, $image_title, $thumbnail_url, $image ), $attachment_id, $post->ID, $image_class ) zoom_magnifier_for_woocommerce.php:387
  46. Ultimate Product Gallery for WooCommerce icon Ultimate Product Gallery for WooCommerce10+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<a href="%s" class="%s" title="%s">%s</a>', esc_url( $props['url'] ), ( empty( $video_url ) ? 'upgfw-image-thumbnail' : 'upgfw-video-thumbnail' ), esc_attr( $props['caption'] ), wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_catalog' ) ) ), $attachment_id, $post->ID, esc_attr( '' ) ) includes/lightbox-mobile.php:57
  47. 3D Product Viewer & WebAR for WooCommerce icon 3D Product Viewer & WebAR for WooCommerce10+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', '<li title="video" class="video-thumbnail"><img width="' . $gallery_thumbnail_size['width'] . '" height="' . $gallery_thumbnail_size['height'] . '" data-skip-lazy="" global-thumb="' . esc_url(get_option('custom_icon')) . '" src="' . esc_url($vide_custom_thumbnails) . '" custom_thumbnail="' . esc_attr($vide_custom_thumbnails) . '" class="product_video_img img_' . $key . ' attachment-thumbnail si... ) 3D-product-viewer-and-webAR-for-woocommerce.php:394
  48. Quicker icon Quicker10+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) core/frontend/ajax-action.php:105
  49. MSY Drop Shipping icon MSY Drop Shipping10+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) public/partials/product-image.php:34
  50. Proshots For WooCommerce icon Proshots For WooCommerce10+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) templates/single-product/product-image.php:53
  51. VariationPress for WooCommerce icon VariationPress for WooCommerce10+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) templates/product-image.php:48
  52. WooLayout icon WooLayout10+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<a href="%s" class="%s" title="%s" data-rel="prettyPhoto[product-gallery]">%s</a>', $image_link, $image_class, $image_title, $image ), $attachment_id, $post->ID, $image_class ) lib/woolayout/single-product/product-thumbnails.php:48
  53. rooom 3D Product Viewer icon rooom 3D Product Viewer10+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', wc_get_gallery_image_html( $thumbnail_id ), $thumbnail_id ) includes/rooom-woocommerce-frontend.php:259
  54. FlexiZoom icon FlexiZoom10+ installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $template, $post_id ) includes/helper.php:120
  55. Variation Gallery Simplified icon Variation Gallery SimplifiedFewer than 10 installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', wc_get_gallery_image_html( $attachment_id, false, $key ), $attachment_id ) public/views/product-thumbnails.php:49
  56. Pixelonetry Product Gallery Slider for Woocommerce icon Pixelonetry Product Gallery Slider for WoocommerceFewer than 10 installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) includes/class-variation-images.php:247
  57. Awesome designs for WooCommerce icon Awesome designs for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) public/templates/1/product-image.php:51
  58. Product Feature Video and Gallery icon Product Feature Video and GalleryFewer than 10 installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', '<li title="video" class="video-thumbnail"><div class="video_icon_img" style="background: url( ' . VIDEOSHOP_URL. 'css/video-icon.svg' . ' ) no-repeat;"></div><img width="' . $gallery_thumbnail_size['width'] . '" height="' . $gallery_thumbnail_size['height'] . '" data-skip-lazy="true" ' . $global_thumb . ' src="' . esc_url( $product_video_thumb_url ) . '" ' . $custom_thumbnail . ' class="produc... ) inc/functions.php:181
  59. StoreBooster icon StoreBoosterFewer than 10 installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) includes/modules/QuickView/class-quickview.php:247
  60. Models3D Studio icon Models3D StudioFewer than 10 installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $main_html, $post_thumbnail_id ) src/Backend/Frontend/GalleryArchitect.php:1821
  61. UnikForce Elementor WooCommerce Builder icon UnikForce Elementor WooCommerce BuilderFewer than 10 installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $thumbnail_id ) includes/woo-data.php:180
  62. Alter Product icon Alter ProductFewer than 10 installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', wc_get_gallery_image_html($id, $index === 0), $id ) includes/Public/WooCommerce/VariationGallery.php:150
  63. HoneyBadger.IT icon HoneyBadger.ITFewer than 10 installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', wc_get_gallery_image_html( $image_id ), $image_id ) honeybadger-it.php:680
  64. Super Elements icon Super ElementsFewer than 10 installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $post_thumbnail_id ) includes/Elementor/ProductImage/ProductImage.php:158
  65. InstaView for WooCommerce icon InstaView for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_single_product_image_thumbnail_html', $instaview_html, $instaview_post_thumbnail_id ) includes/frontend/instaview/product-image.php:56

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.