609 votes
0 answers
shopify - If else statement for showing a different type from Schema Object
I have two different types in my object, i am trying to show only one on my homepage section video text.
My code goes like this
{%if id == 'video_url' %}
<video style="max-width: 100%; height: 100%;" autoplay="autoplay" loop="loop" muted="" webkit-playsinline="" playsinline="" controls="true"> <source src="{{ section.settings.video_url }}" type="video/mp4"/> </video>
{%elsif id == 'video_urlt'%} <video style="max-width: 100%; height: 100%;" autoplay="autoplay" loop="loop" muted="" webkit-playsinline="" playsinline=""> <source src="{{ section.settings.video_urlt }}" type="video/mp4"/> </video>
{%endif %}
and my object in schema is defined like this
"type": "video_url",
"id": "video_url",
"default": "https://www.youtube.com/watch?v=_9VUPq3SxOc",
"label": "Video url youtube",
"info": "Upload your Youtube video to Shopify then paste the url here",
"accept": ["youtube"]
},
{
"type": "text",
"id": "video_urlt",
"default": "Upload your video from files",
"label": "Video url uploaded",
"info": "Upload your video to Shopify then paste the url here"
},
I tried diffrent else if and also changed default properties. I want to have only one div with correct video format on the frontend.
Undefined asked
Source
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.