Add variant-based media grouping for product pages#347
Merged
Conversation
When enabled via Weaverse section settings, filters product media to show only images matching the selected variant option (e.g., Color). Uses variant.image URL matching with graceful fallback to all media when no matches found. Shared/ungrouped media is always appended after matched.
…iants adjacentVariants only returns variants adjacent to the current selection, not all product variants. Added variants(first: 100) to PRODUCT_QUERY to fetch all variants with their images for proper grouping.
|
- Group images by option value (lowercase) into a map - Match selected option value against the group - Ungrouped media = images not matching ANY variant (shared) - Media matching other option values are excluded (not shown) - Re-runs on every variant change
variant.image is 1:1 in Shopify (one image per variant), so URL matching only finds 1 image per color. Now extracts option value from filename (e.g., '24b_xxx_black.jpg' → 'black') to group multiple images per color.
…5.7.0 to 2026.1.0 with detailed migration steps and new features
The variant media grouping feature uses filename-based matching, not variant.image URLs, so this query field was dead weight.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Changes
app/utils/variant-media.ts— Pure utility withgetVariantGroupedMedia()for filename-based variant image matchingapp/components/product/product-media.tsx— AddedgroupMediaByVariant,groupByOption, andproductpropsapp/sections/main-product/index.tsx— Added Weaverse schema settings for the featureapp/sections/single-product/index.tsx— Same schema settings and prop passingWeaverse Settings