Ya llegó Radian 3.0: bundles, escaparate de categorías y animación cinematográfica.Ver novedades

Variant media groups

When a product comes in several colors, showing every image at once makes the gallery long and shoppers see colors they didn't pick. With Show only selected variant media on, the gallery shows the images shared by every variant plus the group of the variant the shopper selected. Choosing another color swaps the group.

It works in the product page, the Featured product section and Quick view, in every gallery layout and in the lightbox.

Radian can work out the groups in two ways. Pick the one that matches how you upload images:

Variant image order: the image you assign to a variant starts its group, and the images after it belong to it. Good when images are uploaded color by color.

Color value in alt text: each image belongs to the color its alt text names, for example Black | Front view. Good when images are in any order, or when several variants (sizes) share a color.

How to set it up

Step 1: Turn it on

  1. In the theme editor, open a product and click the Media block of the Product section.
  2. Turn on Show only selected variant media (1).
  3. Choose Group variant media by: Variant image order or Color value in alt text.
  4. Do the same in the Media block of the Featured product section and of Quick add (Overlay group) if you use them: each block has its own setting.
Media block: Show only selected variant media.
Media block: Show only selected variant media.

Step 2: Option A: group by variant image order

  1. In Shopify Admin, open the product. In Media, drag the images into groups: first the images every color shares (if any), then each color's images together.
  2. In Variants, click each variant, click its image, and choose the first image of its color's group. With a Size option, give every size of the same color the same image.
  3. Each group runs from its variant image to just before the next variant image. Images before the first variant image are shared.
  4. Save the product.

Step 3: Option B: group by color in the alt text

  1. In Shopify Admin, open the product and click an image in Media.
  2. Click Add alt text (or edit it), and start it with the color name exactly as it is in the variant option, for example Black. Capitals don't matter.
  3. To describe the image too, add it after a |: Black | Front view. Only the text before the | is checked for a color, so a description like White background doesn't put the image in the White group.
  4. Leave the color out for images every color should show, such as a size chart.
  5. Repeat for every image and save.

Step 4: Make an image shared, wherever it is

  1. Add #all anywhere in an image's alt text, for example Care label #all. It shows for every variant in both modes. The #all tag is removed from the alt text shoppers and screen readers get.

Step 5: Check the color option name

  1. Alt text grouping looks for the values of your color option. Radian finds that option by its name, set in Theme settings > Variants and swatches > Color options name (default Color, Colour). If your option is called something else, such as Shade, add it there.

Examples

Group by Variant image order: a jacket in Black and Burgundy

1. Size chart Before the first variant image: shared, shows for every color.
2. Black front Assigned to the Black variants: starts the Black group.
3. Black back Black group.
4. Black detail video Black group.
5. Burgundy front Assigned to the Burgundy variants: starts the Burgundy group.
6. Burgundy back Burgundy group.
7. Care label (alt text #all) Shared again, wherever it sits.

With Black selected the gallery shows 1, 2, 3, 4 and 7. With Burgundy selected it shows 1, 5, 6 and 7.

Group by Color value in alt text: the same jacket

Black | Front view Black.
Burgundy | Model, side Burgundy.
Black and burgundy, worn together Both names appear before any |, so the longer name wins: Burgundy. Use #all to share it instead.
Flat lay | White background Shared: no color is named before the |. The word after it is only a description.
Fabric close-up Shared: names no color.

Here the images can be in any order: each one joins its color wherever it sits.

How it works

  • The page loads already filtered: the first view, and links with ?variant=, show only the selected variant's media, so other colors never flash in.
  • A variant without media of its own keeps showing every image, so a shopper never sees an empty gallery.
  • Color value in alt text falls back to Variant image order when the product has no color option, or when no image's alt text names a color value.
  • When one color name contains another, such as Blue and Light blue, the longer name wins.
  • Products with a single variant always show every image.
  • Thumbnails, the lightbox and the counter of Collage of three count only the visible images.

Troubleshooting

Every image still shows.

Check that Show only selected variant media is on in the Media block you are looking at (product page, Featured product or Quick view are separate), that the product has more than one variant, and that the variants have images assigned (Option A) or the alt texts name a color (Option B).

An image shows with the wrong color.

With Option A, check the image order: everything after a variant image belongs to it until the next variant image. With Option B, check the text before the |: it may name two colors.

The size chart disappears when a color is picked.

Move it before the first variant image (Option A), leave the color out of its alt text (Option B), or add #all to its alt text.

Related

Still stuck?

Include your store URL and theme version — we'll get back to you.

Contact support