Update variant metafield based on variant select

rishabh19981
Shopify Partner
1 0 0

how can i update variant metafield  value when variant change. right now I am using this code. 

{% for variant in product.variants %}
{% if product.selected_or_first_available_variant.id == variant.id %}
<strong>{{ variant.metafields.custom.customprice }} </strong>
{% endif %}
{% endfor %}

but it only render the meta field value one time if I visit variant 1 URL then it shows variant 1 meta field value but on same page when I change to variant 2 then metafield value is not updating. but when I visit variant 2 via URL then it show variant 2 metafield value.

Replies 2 (2)

SapoZi
Visitor
1 0 0

I need the same.

FredericVervill
Tourist
7 0 1

Have you found a solution?

Frederic Verville - Floèm