Display Different Variant Metafield For Different Selected Variants.

JJJAAA
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 %}

JJJAAA_0-1656102101610.png

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)

made4Uo
Shopify Partner
3804 713 1124

HI @JJJAAA,

 

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 Made4Uo.com for quick replies.
Stay in control and maintain your security by avoiding unnecessary store access!

MetafieldsGuru
Shopify Partner
158 32 95

Hi @JJJAAA ,

 

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