Re: Display Different Variant Metafield For Different Selected Variants.

Display Different Variant Metafield For Different Selected Variants.

Shopify Partner
1 0 0

Hello, I am trying to display Expiry date for different variant of product. 

There was no problem when I made single product custom metafield, 

But for variant metafield, It seems more complicated than product-metafield. 

I guess it need some json code or other coding.



   {% for variant in product.variants limit:1 %}
     <p>variant.metafields.custom.exdate: {{ variant.metafields.custom.exdate }}<p>
{% endfor %}


I could able to use variant metafield by using that code,  but I want it to be displayed when I click different variant and another variant as well. How can I do it?  

Please help me.. 

Replies 2 (2)

Shopify Partner
3840 716 1177



Yes it will be a little complicated. You need javascript to do so. Unfornately, liquid code cannot listen to the clicks. The javascript code will need to be customized to your theme

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free

Shopify Partner
158 32 100



You may want to refer to this solved thread for a possible solution.

Check out Metafields Guru, the #1 ranked metafields app.

Bulk editor | Data import/export | Metafield sets | Browser extension