Commit 622087e5a8 for woocommerce
commit 622087e5a891534be83e26884bac10c856ad0589
Author: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
Date: Wed Jan 14 10:39:10 2026 +0100
Product Gallery: fix gallery doesn't jump to variation image if it matches product image (#62801)
* Fix lack of image id for variation if it's the same as main image
* Add changelog
diff --git a/plugins/woocommerce/changelog/fix-product-gallery-variation b/plugins/woocommerce/changelog/fix-product-gallery-variation
new file mode 100644
index 0000000000..f4712ed80e
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-product-gallery-variation
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Product Gallery: Fix variation image not displayed when it's the same as the product main image
diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/ProductGallery.php b/plugins/woocommerce/src/Blocks/BlockTypes/ProductGallery.php
index 59aee4c369..a0f80ef8f2 100644
--- a/plugins/woocommerce/src/Blocks/BlockTypes/ProductGallery.php
+++ b/plugins/woocommerce/src/Blocks/BlockTypes/ProductGallery.php
@@ -167,7 +167,7 @@ class ProductGallery extends AbstractBlock {
}
$variation_image_id = (int) $variation['image_id'];
- if ( $variation_image_id && $variation_image_id !== (int) $product->get_image_id() ) {
+ if ( $variation_image_id ) {
$has_variation_images = true;
$formatted_variations_data[ $variation['variation_id'] ] = array(