# Media grouping

With **media grouping**, your product pages will show only the relevant media for the selected variant and hide the rest.

{% hint style="info" %}
To show different product details as well as images, you may want to use [Sibling product swatches](https://github.com/fluorescent/kb-cornerstone/blob/main/product-pages/sibling-product-swatches.md), which links variants to their own product pages.
{% endhint %}

<div><figure><img src="https://475958657-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fyt3Wwaqhge0XvrXmVj7D%2Fuploads%2F35VBa8bI0B0bnwaJYOOm%2Fmedia-group-blue-mobile.png?alt=media&#x26;token=9103c04e-0204-4e35-b95d-b79017a73bcc" alt="" width="186"><figcaption></figcaption></figure> <figure><img src="https://475958657-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fyt3Wwaqhge0XvrXmVj7D%2Fuploads%2FhnLIEKuMhR86PTpGBROW%2Fmedia-group-yellow-mobile.png?alt=media&#x26;token=28484739-0a02-472e-8198-ec0820c3b95a" alt="" width="186"><figcaption></figcaption></figure></div>

### Set up media groups

***

To create **media groups** for variants, first **re-order the product media for each of variant&#x20;*****in sequence***, so that they are grouped together and follow the same order as your product options. Then **assign the first image of each group to the related variant**.

{% hint style="info" %}
When selected, variants will display the assigned image and all following images up until the *next* variant's assigned image.
{% endhint %}

In your **Shopify admin**, go to **Products** to open the product you want to edit:

{% stepper %}
{% step %}

#### Re-order product media in the same order as variants

Using the drag-and-drop handles **`⋮⋮`**, re-order your product media to **group together items for each variant.** The order of the groups should match the order of the variants.

> All media for the first variant should be in the top positions, followed by all media for the second variant, then all media for the third variant, etc.

![Images ordered for the color variants 'Purple', 'Green,' and 'Yellow'.](https://475958657-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fyt3Wwaqhge0XvrXmVj7D%2Fuploads%2Fgit-blob-c35df3dbf9444d8af306de1ee255661b73c1df07%2Fmedia-group-order.png?alt=media)
{% endstep %}

{% step %}

#### Assign the first image of each group to variants

In the **Variants** section, click the **Add image** button next to each variant. Select the first image of the group related to that variant.

> If no image is assigned, the media gallery will not update and will continue to show images of the previously selected variant.

If your product has **multiple options**, assign the first image to each variant of that option.

> For example, if your product has both color and size options, assign the first group image to variants with the same color.

<div><img src="https://475958657-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fyt3Wwaqhge0XvrXmVj7D%2Fuploads%2Fgit-blob-ad052314ae6e208530988c48d9c2553df52d68ab%2Fmedia-group-variant.png?alt=media" alt="Assign the first group image to the related variant." width="375"> <figure><img src="https://475958657-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fyt3Wwaqhge0XvrXmVj7D%2Fuploads%2Fgit-blob-7762f61482abd2316747734347545d635784bbaa%2Fmedia-group-option.png?alt=media" alt="" width="375"><figcaption><p>For multiple product options, assign the first group image to each related variant.</p></figcaption></figure></div>
{% endstep %}
{% endstepper %}

### Enable media grouping

***

After you've set up media groups for your variant images, you can enable media grouping in the **Product overview** settings of your product template.

In your theme editor (**Customize**):

1. Open the product template.
2. Click the **Product overview** section.
3. Toggle on **Enable multiple variant media** option.
4. Click **Save**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.fluorescent.co/cornerstone/product-pages/variant-options/media-grouping.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
