The product_option object is available for each option in a product options array. The product options array is available through product.optionswithvalues.

The product_option object has the following attributes:

product_option.name

Returns the name of the product option.

product_option.position

Returns the position of the product option in the product options array.

 <ul>

  {% for product_option in product.options_with_values %}

  <li>{{ product_option.position }} - {{ product_option.name }} </li>
  {% endfor %}

 </ul>
<ul>
  <li>1 - Color</li>
  <li>2 - Size</li>
</ul>

productoption.selectedvalue

Returns the currently selected value of this product option.

<select>
  {% for value in product_option.values %}
    <option {% if product_option.selected_value == value %}selected{% endif %}>{{ value }}</option>
  {% endfor %}
</select>
<select>
  <option selected>Red</option>
  <option>Green</option>
</select>

product_option.values

Returns an array of possible values of this product option.

 <ul>

  {% for value in product_option.values %}

  <li>{{ value }}</li>
  {% endfor %}

 </ul>
<ul>
  <li>Red</li>
  <li>Green</li>
</ul>