Change the product description on variant selection with theme: pipeline

I’m trying to follow this procedure:

https://docs.minionmade.com/shopify/change-description-based-on-variant-selected-in-shopify

But I understand that

var selectCallback is not the right way to go with the theme pipeline.

I’'m not sure how to fix it.

I’ve added the following lines at the end of product.liquid and it doesn’t work.

For my product description, I was able to add the HTML with my proper product Variant ID

Description for variant 1

Description for variant 2

Any idea how I can fix this?

Hello @koakaya ,

First thing, this is an old way to add the variant description.
To add description with variant you can use variant metafield.

Once you will add it then within the code you have to call it ( you can call all at same time within the loop ) and then with the help of JS show/hide a/to the selected variant.

ok, i’ve included metafields instead for my variants… but now how do I trigger to display the metafield variant on selection?

This is my issue as well! someone help