Liquid, JavaScript, themes, sales channels
I am using the following code to display several file downloads saved in custom metafields:
<h4 class="accordion-title">{{ product.metafields.custom.downloads }}</h4> <p class="accordion-panel"> {% unless product.metafields.custom.cad_files.value == blank %} <u><a target="_blank" rel="noopener noreferrer" href="{{ product.metafields.custom.cad_files.value }}">{{ product.metafields.custom.cad_files_url_title.value }}</a></u> {% endunless %} <br> {% unless product.metafields.custom.specification_guide.value == blank %} <u><a target="_blank" rel="noopener noreferrer" href="{{ product.metafields.custom.specification_guide.value }}">{{ product.metafields.custom.specification_guide_url_title.value }}</a></u> {% endunless %} <br> {% unless product.metafields.custom.installation_guide.value == blank %} <u><a target="_blank" rel="noopener noreferrer" href="{{ product.metafields.custom.installation_guide.value }}">{{ product.metafields.custom.installation_guide_url_title.value }}</a></u> {% endunless %} <br> {% unless product.metafields.custom.tech_drawing.value == blank %} <u><a target="_blank" rel="noopener noreferrer" href="{{ product.metafields.custom.tech_drawing.value }}">{{ product.metafields.custom.tech_drawing_url_title.value }}</a></u> {% endunless %} <br> {% unless product.metafields.custom.trifold_url_download.value == blank %} <u><a target="_blank" rel="noopener noreferrer" href="{{ product.metafields.custom.trifold_url_download.value }}">{{ product.metafields.custom.trifold_url_title.value }}</a></u> {% endunless %} </p>
However, when the value is blank it displays as an empty line. How do I get it to remove the line if the value is returned as 0.
Solved! Go to the solution
This is an accepted solution.
Hi @Gumf
Wrap your code div and remove the tag br
First step is moving your <br> tag to be within your unless statement. Currently, the break sits outside so will always be rendered.
This is an accepted solution.
Hi @Gumf
Wrap your code div and remove the tag br
Worked perfectly thank you!
User | RANK |
---|---|
38 | |
29 | |
13 | |
12 | |
9 |
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023