Use case

To display additional info based on selected variant apart from product descriptions.


Save the additional info as a variant metafield and display it based on variant change using javascript.

  {% for variant in sample_product.variants%}
    {% assign variantHandle =  variant.title | handle %}
        <div id="{{variantHandle}}" class="variant-description" 
        {% unless ==} 
    {% endfor %}

Assuming the select dropdown has an attribute data-handle={{variant.title | handle}} and class called option-selector

    var variantHandle = $(this).attr(data-handle)