Supporting Package Media on Custom Store Templates
If you’re using a custom or legacy store template, you may not see all package images (when multiple images are uploaded) or the package video.
If you are using the Exo template, this guide does not apply.
Older templates relied on the package.image
property to display a package’s image URL. To support package media properly, you now need to use the new package.media
array instead. See the example code snippet below demonstrating how to use the new media array.
{% for media in package.media %}
<div class="slide">
{% if media.type == 'image' %}
<img
class="slide-image"
src="{{ media.url }}"
alt="{{ package.name }}"
/>
{% elseif media.type == 'video' %}
<iframe
class="slide-frame"
src="https://www.youtube.com/embed/{{ media.url }}?color=white&rel=0"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen
></iframe>
{% endif %}
</div>
{% endfor %}
Last updated
Was this helpful?