How can I exclude a code section from a specific product page?

How can I exclude a code section from a specific product page?

MelanieGolden
Visitor
2 0 0

B9B7442D-3625-4959-A803-58A35B76FB4D.png

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)

Jason
Shopify Partner
11206 226 2314

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. http://freakdesign.com.au ★

Simonsron
Shopify Partner
699 87 122
{% if product.metafields.custom.product_video.value != blank  %}
//your iframe here...
{% endif %}
banned