The media object
media object represents an object returned in a
product.media array. The media object is an abstract object that can represent the following object types:
media object can also be returned by metafields of type
file_reference (images and videos only). To learn more about accessing metafield values, refer to Accessing metafields.
media object has the following attributes. Some attributes unique to each media type are also available. For more information about these additional attributes, refer to the reference for each supported object type.
Returns the alt tag of the media, set in the Products page of the Admin.
Returns the ID of the media.
media.media_typeAnchor link to section titled "media.media_type"
Returns the media type of the object.
media_type property can be used to filter the
product.media array for all media of a desired type.
media.positionAnchor link to section titled "media.position"
Returns the position of the specific media object in the
product object's media array.
media.preview_imageAnchor link to section titled "media.preview_image"
Returns a preview image for the media.