Hi,
I have an if/else statement that checks if a file metafield has a value in it, and if it’s empty, it should use a specific GID that I’m putting directly in the liquid code block.
The desired purpose is to display a backup image when the object doesn’t have an image selected.
The problem I have is that an identical GID doesn’t work when assigned as a string, while it does work when assigned from the metafield. How do I need to format this GID string so that it will work when assigned “manually”?
{% for item in shop.metaobjects.metaobject_name.values %}
{% if item.brand.value.brand != blank %}
{% if item.top_image != blank %}
{% assign card_image = item.top_image %}
{% else %}
**{% assign card_image = 'gid://shopify/MediaImage/62419296813284' %}**
{% endif %}
<a href="{{item.metaobject_system.url}}" style="text-decoration: none;">
<div class="repeater-card">
<div class="repeater-image-container">
<img src="**{{ card_image | image_url }}**" alt="{{item.title}}" loading="lazy">
</div>
<h4>{{ item.title }}</h4>
<p>{{ item.intro_title }}</p>
</div>
</a>
{% endif %}
{% endfor %}
