The external_video object

The external_video object can be accessed from the product object's media attribute. It contains information about a YouTube video associated with a product.

This page describes the different attributes of the external_video object.

external_video.alt

Returns the alt tag of the video set on the product details page of the Shopify admin.

external_video.external_id

Returns the ID of the YouTube video.

Input

{% assign external_videos = product.media | where: "media_type", "external_video" %}

{% for external_video in external_videos %}
  {{ external_video.external_id }}
{% endfor %}

Output

neFK-pv2sKY
JthaEfEsLYg

external_video.host

Returns the name of the video host (youtube).

external_video.id

Returns the media_id of the external video.

external_video.media_type

Returns the type of the object (external_video). This can be used to filter the product object's media array.

Input

{% assign external_videos = product.media | where: "media_type", "external_video" %}

{% for external_video in external_videos %}
  {{external_video.external_id}}
{% endfor %}

Output

neFK-pv2sKY
JthaEfEsLYg

external_video.position

Returns the position of the external_video in the product object's media array.

Ready to start selling with Shopify?

Try it free