Product Gallery block: Add support for variation image updates #11459
Product Gallery block: Add support for variation image updates #11459
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: +2.29 kB (0%) Total Size: 1.53 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing job, @thealexandrelara. Thank you for working on this. It was a tricky one!
The PR is working correctly :)
I have added a few minor suggestions/questions. That said, I am pre-approving, as everything is working correctly.
Great work! I didn't review the code, but from the GIF works very smoothly! This feature is a very important feature for the Product Gallery! Keeping this in mind and given that we are using the Interactivity API, I see a lot of value in adding E2E tests to avoid any potential regression in the future. What do you think? |
Yes, I completely agree with you, I had started creating some e2e tests yesterday on a separate PR, hopefully I'll complete and submit the PR today. |
So in my testing, I find that only the second option in the second dropdown is working (atleast from using the same sample product in your gif). So I select "Blue" and then I select "Yes". I am expecting the main image to change because there is actually a different image for that variation combo. But only when I select "No" is when it changes. |
Yes, in the "What" section of this PR I explained more about this behavior:
Basically, since we have a limited number of visible thumbnails, I'm restricting the display to only show those that are currently visible. If a thumbnail is not available, the image will not change. I'm implementing this restriction because displaying images from thumbnails that are not visible could lead to losing track of the currently selected thumbnail for the Pager and Thumbnails block. However, we can certainly discuss how to present this to the shoppers or maybe improve the current state implementation to support images that are not visible (but since we will display all images inside the dialog, maybe we should wait for that work to be completed before modifying the current behavior). |
Ok I totally misunderstood that statement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! Everything is working as described aside from the noted issue of images not in the side thumbnails will not change.
Important
This issue is blocked by #11458
What
The current implementation for the Product Gallery does not offer support for variation image updates. This PR adds the following functionalities:
Fixes #10880
Why
When the shopper selects a product variation, the Large Image block should replace its displayed image with the one from the selected product variation.
Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
Screenshots or screencast
WooCommerce Visibility
Required: