Shopify themes, liquid, logos, and UX
I have a metaobject called "discography" with a number of metafields giving information about releases, one metafield discography.variants references another metaobject called variants which includes information about various pressings.
I have a discography page which displays packshots for all of my releases using this code [I've removed my website name just for privacy 🙂
<div class="discography-grid">
{% for discography_item in shop.metaobjects.discography.values %}
<a class="discography-item" href="https://store.website.com{{ discography_item.system.url }}">
{% if discography_item.packshot %}
<img src="{{ discography_item.packshot | image_url }}" alt="{{ discography_item.title }}" class="discography-packshot">
{% endif %}
<h3 class="discography-title">
{{ discography_item.title }}
</h3>
<p class="discography-catalog-number">
Catalog #: {{ discography_item.catalog_number }}
</p>
</a>
{% endfor %}
</div>
But on the individual pages I can't figure out how to display the variants metafield / metaobject?
This prints information for EVERY variant entry not just the entries that are attached to the discography.variants metafield?
<div class="discography-variants"> <h3>Variants:</h3> <ul> {% for variant in shop.metaobjects.variants.values %} <li> <strong>{{ variant.pressing_info }}</strong> </li> {% endfor %} </ul> </div>
Sorry if any of that isn't described well.
Please help!
Hi @crumbscrumbs,
Please change code:
shop.metaobjects.variants.values => variant.metaobjects.variants.values
Unfortunately with that change nothing displays?
<pre>All Variants: {{ variant.metaobjects.variants.values | json }}</pre> returns null.
<div class="discography-variants">
<h3>Variants:</h3>
<ul>
{% for variant in variant.metaobjects.variants.values %}
<li>
<strong>{{ variant.pressing_info }}</strong>
</li>
{% endfor %}
</ul>
</div>
Hi @crumbscrumbs,
The variant declared? If not, please change the code below:
{% for variant_product in product.variants %}
<pre>All Variants: {{ variant_product.metaobjects.variants.values | json }}</pre> returns null.
<div class="discography-variants">
<h3>Variants:</h3>
<ul>
{% for variant in variant_product.metaobjects.variants.values %}
<li>
<strong>{{ variant.pressing_info }}</strong>
</li>
{% endfor %}
</ul>
</div>
{% endfor %}
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025