Skip to content

Conversation

@woocommercebot
Copy link
Collaborator

@woocommercebot woocommercebot commented Sep 29, 2025

This PR is a cherry-pick of #61013 to release/10.2.

Closes #61138

Original PR Description

Submission Review Guidelines:

Changes proposed in this Pull Request:

Problem:

When larger sized images are added to a product’s gallery, the images in large image field appear blurred (100x100) when clicked - only additional images, not main image. However, when hovering to zoom, the same images display clearly.

Core problem:

The core issue was in the wc_get_gallery_image_html() function in here

$image_size = apply_filters( 'woocommerce_gallery_image_size', $flexslider || $main_image ? 'woocommerce_single' : $thumbnail_size );

$flexslider was false because the woocommerce_single_product_flexslider_enabled filter was not yet called and hence the image size $image_size defaulted to thumbnail_size.

Solution:

The solution is moving the legacy filters to the block's render method so that they actually fired during block render and not too late, during script enqueueing (after rendering).

Closes #61012.

How to test the changes in this Pull Request:

  1. Go to Editor > Single Product
  2. Make sure you use Product Image Gallery block
  3. Go to the frontend to products with multiple high res images
  4. Go through them, make sure all of them are high res

Videos:

Before After
https://github.com/user-attachments/assets/1d0d86ce-4f67-4d5f-b59f-a0713a4a1c40 https://github.com/user-attachments/assets/77b1cd47-dcb4-445a-abfc-28c0d838abd4

* Move add_filter calls to block initialize(). Closes #61012.

* move legacy gallery filters into render()

* Finish moving add_action() to render() as well.

* Revert add_action() back to original place in enqueue_legacy_assets()

---------

Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
@github-actions github-actions bot added this to the 10.2.0 milestone Sep 29, 2025
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Sep 29, 2025
@kmanijak kmanijak requested a review from dinhtungdu September 29, 2025 09:36
@github-actions
Copy link
Contributor

github-actions bot commented Sep 29, 2025

Testing Guidelines

Hi @Aljullu @dinhtungdu ,

Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.

Reminder: PR reviewers are required to document testing performed. This includes:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

@kmanijak kmanijak requested a review from Aljullu September 29, 2025 09:36
@github-actions
Copy link
Contributor

github-actions bot commented Sep 29, 2025

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Test this pull request with WordPress Playground.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit.

Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for investigating this, @kmanijak! It's looking good to me:

release/10.2 This branch
Image Image
Testing environment
  • WordPress 6.8.2 local dev environment
  • Plugins: -
  • Theme: TT5
  • Store creation: September 2025
  • Store size: small

@kmanijak kmanijak merged commit 3b77592 into release/10.2 Sep 29, 2025
69 of 72 checks passed
@kmanijak kmanijak deleted the cherry-pick-PR61013-to-release/10.2 branch September 29, 2025 10:16
@github-actions github-actions bot added the metric: feature freeze exception A tracking label for PRs that were merged after the feature freeze. label Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

metric: feature freeze exception A tracking label for PRs that were merged after the feature freeze. plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants