{%- doc -%} Renders a product media gallery for use with `media-gallery.js`. @param {string[]} variant_images - Image URLs for product images associated with a variant. @param {product} [product] - The product whose media is rendered. Uses the current product when omitted. @param {object} [section] - The current product section context, supplied implicitly when rendered from that section and used for gallery IDs, behavior, and presentation. @param {number} [limit] - The maximum number of media items to render. Defaults to all media. @param {model} [first_3d_model] - The first 3D model, used to render the gallery's Shopify XR button. @example {% render 'product-media-gallery', product: product, variant_images: variant_images, first_3d_model: first_3d_model, limit: 1 %} {%- enddoc -%} {%- liquid if section.settings.hide_variants and variant_images.size == product.media.size assign single_media_visible = true endif if limit == 1 assign single_media_visible = true endif assign media_count = product.media.size if section.settings.hide_variants and media_count > 1 and variant_images.size > 0 assign media_count = media_count | minus: variant_images.size | plus: 1 endif if media_count == 1 or single_media_visible assign single_media_visible_mobile = true endif if media_count == 0 or single_media_visible_mobile or section.settings.mobile_thumbnails == 'show' or section.settings.mobile_thumbnails == 'columns' and media_count < 3 assign hide_mobile_slider = true endif if section.settings.media_size == 'large' assign media_width = 0.65 elsif section.settings.media_size == 'medium' assign media_width = 0.55 elsif section.settings.media_size == 'small' assign media_width = 0.45 endif -%}
{{ 'accessibility.skip_to_product_info' | t }}
1 {{ 'general.slider.of' | t }} {{ media_count }}
{%- if first_3d_model -%} {%- endif -%} {%- liquid assign is_not_limited_to_single_item = false if limit == null or limit > 1 assign is_not_limited_to_single_item = true endif -%} {%- if is_not_limited_to_single_item and media_count > 1 and section.settings.gallery_layout contains 'thumbnail' or section.settings.mobile_thumbnails == 'show' -%} {%- endif -%}