All things Shopify and commerce
Display multiple entry using metaobjects and meta field Shopify product page
need to display image and title block in product page using metaobjects how can do it?
{% assign test = product.metafields.custom.test.value | json_parse %}
<div class="ingredients-section">
<h2>{{ test.section_title }}</h2>
<p>{{ test.section_subtitle }}</p>
<div class="ingredients-slider">
{% for i in (0..test.ingredients_image.size) %}
{% assign image_url = test.ingredients_image[i] | img_url: 'master' %}
<div class="swiper-slide ingredients__item">
<img
src="{{ image_url }}"
alt="{{ test.ingredients_title[i] }}"
class="ingredients__image"
>
<p class="ingredients__name">{{ test.ingredients_title[i] }}</p>
</div>
{% endfor %}
</div>
</div>
Hi,
Need to use Metaobjects product template
Code example to display Metaobjects
{% if product.metafields.custom.metaobject_field %}
{% for entry in product.metafields.custom.metaobject_field.value %}
<div class="metaobject-entry">
<img src="{{ entry.image | img_url: 'large' }}" alt="{{ entry.title }}">
<h3>{{ entry.title }}</h3>
{% if entry.description %}
<p>{{ entry.description }}</p>
{% endif %}
</div>
{% endfor %}
{% endif %}
{% if product.metafields.custom.test %}
{% for entry in product.metafields.custom.test.value %}
<div class="metaobject-entry">
<img src="{{ entry.ingredients_image | img_url: 'large' }}" alt="{{ entry.title }}">
<h3>{{ entry.ingredients_title }}</h3>
</div>
{% endfor %}
{% endif %}
Showing array in title
and image showing blank
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024