Display Different Variant Metafield For Different Selected Variants.

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
3845 717 1188

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

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 Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free

MetafieldsGuru
Shopify Partner
160 32 102

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