[Backport to release/10.2] Move add_filter calls to block initialize(). Closes #61012. #61173
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


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 herewoocommerce/plugins/woocommerce/includes/wc-template-functions.php
Line 1752 in 0f3a501
$flexsliderwas false because thewoocommerce_single_product_flexslider_enabledfilter was not yet called and hence the image size$image_sizedefaulted tothumbnail_size.Solution:
The solution is moving the legacy filters to the block's
rendermethod 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:
Videos: