I am developing a theme from scratch and I am facing a problem where I am rendering the product options as radio button groups. When the user selects or changes the radio button, I am updating the price accordingly. My problem is, I don’t know how to select the first available variant as the selected radio button values. The way I am doing it, it’s making the last available variant as the default selected radio buttons when the page loads.
Any help will be much appreciated. Here is my code:
{{ price | money }}
{% for product_option in product.options_with_values %}
#### {{ product_option.name }}
{% for value in product_option.values %}
{% endfor %}
{% endfor %}
