# Variant Images Group

Preview for hiding other variant images:

{% embed url="<https://ascentelevated.myshopify.com/products/midtown-tennis-skirt8?variant=50047753912604>" %}

By adding the `alt` attribute to product images and grouping them by variant, you can achieve the effect of displaying only the image set for the currently selected variant. The specific steps are as follows:

<figure><img src="https://3086053958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtxdyhQYbUmYMEm4SSNh%2Fuploads%2FfBl4iVfHVb1R2yAAB4oI%2F%E5%BD%95%E5%B1%8F2024-12-26%20%E4%B8%8A%E5%8D%889.55.41.gif?alt=media&#x26;token=359c482f-2135-4a2b-98ef-715cfff6c9bd" alt=""><figcaption><p>Show Variant Image Group</p></figcaption></figure>

### Add the `alt` attribute to product images.

In the product editing page, select the images you want to group and add an `alt` attribute value, such as `###Purple`.\
Images with the same `alt` value (prefixed with `###`) will be grouped together.

{% hint style="warning" %}
The `alt` attribute value must be prefixed with `###` to enable the grouping functionality.
{% endhint %}

<figure><img src="https://3086053958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtxdyhQYbUmYMEm4SSNh%2Fuploads%2FPblrHsd9wE9YH817oWvE%2Fimage.png?alt=media&#x26;token=1a72953d-25b5-4833-bf28-b575577e1bc8" alt=""><figcaption><p>Add Alt Attribute</p></figcaption></figure>

### Set variant images.

In the variant settings, assign a main image to each variant. All images in the same group as the main image will be displayed when that variant is selected.

<figure><img src="https://3086053958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtxdyhQYbUmYMEm4SSNh%2Fuploads%2FlDreWcMMT0veltB3k0C4%2Fimage.png?alt=media&#x26;token=4b4d8202-5699-464c-b570-391764a87e6d" alt=""><figcaption><p>Set Variant Images</p></figcaption></figure>

### Enable the "Hide Other Variant Images" setting.

In the theme editor, go to the product settings and enable the "Hide Other Variant Images" option. Once enabled, only the current variant's image group will be displayed, while other images will be hidden.

<figure><img src="https://3086053958-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtxdyhQYbUmYMEm4SSNh%2Fuploads%2F7O1upQj524wVBPzeSE7c%2Fimage.png?alt=media&#x26;token=3321b326-c190-4399-9536-33f0f8628fd6" alt=""><figcaption><p>Enable Hide Other Variant Image Setting</p></figcaption></figure>
