Shopify themes, liquid, logos, and UX
A video section when selecting the video from shopify host, it appears probably in the theme customizations, but when I publish or preview, the placeholder appears instead. Can anyone help with that issue?
Here's the code used in video.liquid template:
{% liquid assign video_url = '' for source in section.settings.shopify_video.sources assign format = source.url | slice: -4, 4 if format == ".mp4" assign video_url = source.url endif endfor assign placeholder_video = 'https://cdn.shopify.com/videos/c/o/v/fbb140fd46e3429eba459e1549dbbe38.mp4' if video_url == blank assign video_url = placeholder_video endif %} <video src="{{ video_url }}" playsinline {% if section.settings.show_controls %} controls {% endif %} {% if section.settings.loop %}loop{% endif %} {% if section.settings.muted %} muted {% if section.settings.autoplay %} autoplay{% endif %} {% endif %} > </video> {%- endif -%}
I am using minimog theme.
Solved! Go to the solution
This is an accepted solution.
Hi @amrhassan
I have updated the code and it is working I have checked it on test store, Check the snippet below
{% assign video_url = '' %}
{% assign video_url = section.settings.shopify_video.sources[1].url %}
{% assign placeholder_video = 'https://cdn.shopify.com/videos/c/o/v/fbb140fd46e3429eba459e1549dbbe38.mp4' %}
{% if video_url == blank %}
{% assign video_url = placeholder_video %}
{% endif %}
<video
src="{{ video_url }}"
playsinline
{% if section.settings.show_controls %}
controls
{% endif %}
{% if section.settings.loop %}
loop
{% endif %}
{% if section.settings.muted %}
muted
{% if section.settings.autoplay %} autoplay{% endif %}
{% endif %}
></video>
@amrhassan - is video format other than mp4?
No, it's mp4
@amrhassan - can you share that video link?
Hi,
You can try video from Youtube
A video from youtube works fine but I need to show a specific video hosted on shopify not youtube.
I have already seen this post, this solution will ruin my section settings. I want to fix the code to work fine with the other section settings.
This is an accepted solution.
Hi @amrhassan
I have updated the code and it is working I have checked it on test store, Check the snippet below
{% assign video_url = '' %}
{% assign video_url = section.settings.shopify_video.sources[1].url %}
{% assign placeholder_video = 'https://cdn.shopify.com/videos/c/o/v/fbb140fd46e3429eba459e1549dbbe38.mp4' %}
{% if video_url == blank %}
{% assign video_url = placeholder_video %}
{% endif %}
<video
src="{{ video_url }}"
playsinline
{% if section.settings.show_controls %}
controls
{% endif %}
{% if section.settings.loop %}
loop
{% endif %}
{% if section.settings.muted %}
muted
{% if section.settings.autoplay %} autoplay{% endif %}
{% endif %}
></video>
It worked!!! Thank you so much.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025