Button add to cart not working for product metafield

Imago
New Member
6 0 0

I used shopify metafilds to get related products. I created the "reference" metafild with the product and added the liquid code to my product page template.

This is the code I have

<div class="recommended-products">
{% if product.metafields.my_fields.prodotto_correlato != blank %}
{% assign current_variant = product.metafields.my_fields.prodotto_correlato.value %}

<a href="{{ current_variant.url }}">
<img src="{{ current_variant.featured_image | img_url: '100x' }}">
<div>
<p>{{ current_variant.title }}</p>
<p class="uaf__price">{{current_variant.price | money }}</p>
</div>
</a>

<input data-btn-addToCart type="submit" name="add" class="btn"

value="{{ 'products.product.add_to_cart' | t }}">



{% endif %}
</div>
However, I am unable to add the add to cart button to the metafield product. Can someone help me?

Replies 0 (0)