I’m not at home so I can’t test this but you could try removing the if statements like I have here
{%- if media.media_type == ‘image’ -%}
<img
srcset="{%- if media.preview_image.width >= 550 -%}{{ media.preview_image | img_url: ‘550x’ }} 550w,{%- endif -%}
sizes=“(min-width: 750px) calc(100vw - 12rem), 100vw”
src=“{{ media.preview_image | img_url: ‘750x’ }}”
alt=“{{ media.alt | escape }}”
loading=“lazy”
width=“1100”
height=“{{ 1100 | divided_by: media.preview_image.aspect_ratio | ceil }}”
data-media-id=“{{ media.id }}”
{% if variant_image %}class=“product__media-item–variant”{% endif %}
{%- else -%}