I setup a specific metafield for a video file that I wanted to show up on one product page only however it is populating to all my various products.
Can anyone please explain or provide help on some specific steps I can take to make ‘video’ metafield show up on one specific product page only? I can edit code and understand some of it, just not sure where to begin with which file or which code to add/ edit.
Thanks!
Hi,
Please use the code below to show only the video links are added in your metafields.
{% assign my_video = product.metafields.sf_video_link %}
{% if my_video != blank %}
{{ my_video }}
{% else %}
{% endif %}
Or
{% assign my_video = product.metafields.sf_video_link %}
{% if my_video != blank %}
YOUR COMPLETE VIDEO LOADING HTML HERE
{% else %}
{% endif %}
If you don’t understand, please let me know.
Hope it helps.
Thanks.
Thank you, however where in this code does it state to only show the metafield on product ‘xyz’ for instance? Or is that not needed to just add the code to the specific product page only?
The code has a condition “if”.
The code is for product-template.liquid
If the metafields value is entered (when the field is not blank), load the code and show the video.
If there is no value entered (the metafield in your product edit page) in your product metafields, nothing will show up. So, if you entered the code in product A, X & Y pages, the video will only show on those product A, X & Y pages, and all other products will not show the video.
If you were not sure about the liquid code, please do not modify your product-template.liquid.
It will mass up your product page.
Thanks.
Hi,
Please use the code below to show only the video links are added in your metafields.
{% assign my_video = product.metafields.sf_video_link %}
{% if my_video != blank %}
{{ my_video }}
{% else %}
{% endif %}
Hi there. Is there a way to select metafields for specific products only and disable it for other products? I have 3 different collections, however all of the metafields that I created are showing up on all products when I only need them for certain collections. Any recommendations would be so greatly appreciated.