Shopify themes, liquid, logos, and UX
Hi all,
I'm developing a custom block in OS 2.0 and inside the product-template.liquid file I'm using the
{%- when 'optical_link' -%}
to show the block when it's selected from the theme editor.
Till here everything seems working fine, the link is visible and it works.
Now I need this section to appear only if the link is not blank so I've added the if statement as following
{%- when 'optical_link' -%}
{%if product.metafileds.my_fields.optical_link != blank %}
<div class="optical-link">
<span>{{block.settings.optical_link_text}}</span>
<a href="{{block.settings.optical_url}}">Click Here</a>
</div>
{% endif %}
Unfortunately when I add the if statement nothing is showing up even if the metafield is not blank.
If I remove the if statement everything works fine.
Is there someone who could help me out?
Solved! Go to the solution
This is an accepted solution.
t was a typo in the copy paste, but thanks 🙏
Anyway I've solved by using the .value
Did you copy and paste that code into this post?
There’s a typo - you have metfileds not metafields.
This is an accepted solution.
t was a typo in the copy paste, but thanks 🙏
Anyway I've solved by using the .value
Good day.
I have the same problem. I have checked everywhere and can't find any solution.
Below is my coding
For some reason it is just not returning any value after I have put this in.
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024