FROM CACHE - en_header

Button add to cart not working for product metafield

Shopify Partner
18 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' }}">
<p>{{ current_variant.title }}</p>
<p class="uaf__price">{{current_variant.price | money }}</p>

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

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

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

Replies 0 (0)