New Shopify Certification now available: Liquid Storefronts for Theme Developers

Coding help - if/unless tags?

2 0 0


Hello! I’m looking for help. I have this section of code added to my product pages, but I want to exclude it from a certain page. I thought maybe by using the unless code, but I’m unsure of how to change it while still keeping the ability of it to be hidden if the meta field is blank. I hope this makes sense. Please help!



Replies 2 (2)
Shopify Expert
11159 222 2274

You may not need an unless.

Does something like the below help at all?

{% if product.metafields.custom.product_video != blank and product.handle != "foo" %}
{% endif %}


I would rarely add the handle into an if statement like this and would be more likely to start added a list of allowed (or blocked) pages and comparing against that. If you think you'll only need that one product page to ignore that the above code might be enough for now.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. ★
Shopify Partner
699 87 121
{% if product.metafields.custom.product_video.value != blank  %}
//your iframe here...
{% endif %}