# Variable product gallery image sync with variation selection (SUP-24126)

**Date:** 2026-04-06  
**Support Ticket:** SUP-24126

## What changed

- Added a small frontend script on variable single-product pages that runs on WooCommerce `found_variation` and aligns the default WooCommerce product gallery DOM with the selected variation image.
- Updates main and active-slide `<img>` attributes, matching `<picture><source>` `srcset` / `data-srcset`, anchor `href`, zoom layer image, flexslider slide when available, and re-triggers WooCommerce gallery zoom/resize hooks.

## Why

On some sites (e.g. WebP `<picture>` markup), the visible gallery image could stay wrong while hover zoom or anchor reflected the variation image. Woo’s variation handler did not always keep `<source>` and the active slide in sync with `<img>`.

## Files changed

- `includes/core/frontend-scripts.php` — `bodycommerce_print_variable_product_gallery_sync_script()` hooked to `wp_footer`.

## Notes

- ⚠️ Script requires jQuery (same as WooCommerce variation forms). No console logging in production.

## Related

- PP Gallery module / default Woo gallery on variable products.
