All things Shopify and commerce
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
i have created metafield for cross-selling product in my admin
i want to display cross-selling product in my product page below.
product id is perfectly getting displayed but not he product image. Not getting what exactly is the issue with these
can anyone help?
Hi,
Verify Metafield Setup
At Product Template - insert code to display cross-sell product
Code example
{% assign cross_sell_product_id = product.metafields.namespace.key %}
{% if cross_sell_product_id %}
{% assign cross_sell_product = all_products[cross_sell_product_id] %}
{% if cross_sell_product %}
<div class="cross-sell">
<h3>Recommended for you</h3>
<a href="{{ cross_sell_product.url }}">
<img src="{{ cross_sell_product.featured_image | img_url: 'medium' }}" alt="{{ cross_sell_product.title }}">
<p>{{ cross_sell_product.title }}</p>
</a>
</div>
{% endif %}
{% endif %}
by trying above code
still not getting displayed