How can I modify a custom liquid statement to display links only when a file is uploaded?

Raj29
Visitor
3 0 0

Hi can any one help me with this statement..I need it to modify if there is no link ..not to display anything..if there is file then only display the link..how to use if and end if statement here please help

..at moment this link shows up on every product even if there is no file uploaded the link still shows up on every product..I want the code to only show link in those products where I have uploaded my file 

20230530_112708.jpg

Replies 2 (2)

Ryan_Mc
Explorer
46 0 17

Can try this... 

{% if product.metafields.custom.customfile != empty %}
  <!-- Put your existing code here -->
{% endif %}

miguel_liquify
Shopify Partner
176 18 16

Try this

{% if product.metafields.custom.customfile != blank %}

 

{% endif %}

★★★ Need help setting up your Shopify store? Hire me here: https://liquify.design ★★★