Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I have have metaobjects that references a list of products.
For example:
I have created a "Artist" metaobject
This metaobject has some fields such as name, location and releases.
Releases is a list of references to products "Releases" for that specific artist.
In the admin for example i can see a list of all the products being referenced for that artist, but i havent been able to find a way to do the same on my template. where i want to list all the releases that artist has when user goes to the Artist metaobject page.
See screenshot of how it looks in the admin:
Hello,
I have the same question.
Can't find an answer on the documentation.
Same here. Can't access these references.
The only way we could accomplish this is to create a category with all the products for that metaobject and then assign it to the metaobject itself. But this way we are having more work.
But personally I don't think it makes sense. There should be a way to access the products referenced by a metaobject
Yeah, how is this not an option? Literally the reason the references are there.
This is possible.
Here is some code to get you started. It will pull in a list of products and the URL, featured image, title, and description for each of them. Then you can use CSS to customize the appearance or figure out how to pull in different data fields from the products and reorder them.
{% paginate collections["all"].products by 3000 %}
{% for product in collections.all.products %}
{% if product.metafields.custom.METAFIELD_NAME_HERE.value.title == metaobject.title %}
<a href="{{product.url}}">
<div class="repeater-card">
<img src="{{product.featured_image | image_url }}" width="200px" height="200px">
<h4>{{ product.title }}</h4>
<p>{{ product.description }}</p>
</div>
</a>
{% endif %}
{% endfor %}
{% endpaginate %}
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024