media
An image or video upload field. The merchant can upload or select media from the store's media library. Returns a CDN URL string.
Properties
| Property | Type | Required | Description |
|---|---|---|---|
type | "media" | Yes | Field type identifier |
label | string | Yes | Label shown in the builder |
default | string | No | Default value (empty string if omitted) |
Usage
- schema.json
- Template
- Output
{
"hero_media": {
"type": "media",
"label": "Image or Video",
"default": ""
}
}
{% if widget.settings.hero_media %}
<img src="{{ widget.settings.hero_media }}" alt="">
{% endif %}
{
"hero_media": "https://cdn.example.com/hero.jpg"
}
tip
Always wrap media in an {% if %} check since the field may be empty if the merchant hasn't uploaded anything yet.
Interactive Preview
Interactive Preview
Click to uploadPNG, JPG, WEBP, MP4
Live Output
{
"hero_media": ""
}