New Shopify Certification now available: Liquid Storefronts for Theme Developers

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
3787 710 1101



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

Volunteering to assist you!  Likes and Accept as Solution  is highly appreciated.✌
Coffee fuels my dedication. If helpful, a small Coffee Tip would be greatly appreciated.
Need EXPERIENCED Shopify developer without breaking the bank?
Hire us at for quick replies.
Stay in control and maintain your security by avoiding unnecessary store access!
Shopify Partner
157 32 90



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