Skip to content

Skip WooCommerce gallery images#90

Merged
PabloPerezDeCiriza merged 13 commits intotinify:masterfrom
wcreateweb:feat/skip-wc-gallery-imgs
Feb 5, 2026
Merged

Skip WooCommerce gallery images#90
PabloPerezDeCiriza merged 13 commits intotinify:masterfrom
wcreateweb:feat/skip-wc-gallery-imgs

Conversation

@tijmenbruggeman
Copy link
Collaborator

Currently the product variation image gallery is not displaying the correct image when selecting it.
WooCommerce uses JavaScript to set a new image when it is selecting a different variation. Unfortunately this targets the root image and not the source of our picture element.

Added

  • WooCommerce compatibility class;
  • Added filter to prevent picture elements to be injected on product pages;

Changed

  • Moved picture filter to latest possible moment to make sure we can check for page types. On init was to early as wordpress was not fully initialized yet. This required the settings to be injected into the picture class as well;

Considerations

  • I had created an additional filter to skip certain DOM elements but the regex on that was a bit to brittle so decided to keep it simple for now and skip the entire product page.
  • Did not add integration tests because of the dependency on WooCommerce. Overall not quite happy with adding Third Party plug-ins to integration tests as it'll slow down things quite considerably.

@PabloPerezDeCiriza PabloPerezDeCiriza merged commit d2f12eb into tinify:master Feb 5, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants