_onSelectChange not working for changing url when variant selected

Highlighted
Tourist
10 0 1

Hi, I am trying to change the url in address bar when variant is selected. But it doesn't seem to work. I tried to add consoles, but found out _onSelectChange was not working, any help appreciated, thanks!

Highlighted
Shopify Expert
65 2 5

the price set from  

 {%- assign current_variant = product.selected_or_first_available_variant -%}

 you can try with 

  <ul>{% for variant in product.variants %}
              <li class="{% cycle 'odds': 'odd', 'even' %}">
                {% if variant.available %}<input type="radio" name="id" value="{{ variant.id }}" id="radio_{{ variant.id }}" {% if forloop.first %}checked="checked"{% endif %} />
                  <label for="radio_{{ variant.id }}" class="radio">
                    <strong>{{ variant.title | escape }}</strong> for <span class="bold-blue">{{ variant.price | money }}</span>
                    {% if variant.price < variant.compare_at_price %}<del>{{ variant.compare_at_price | money }}</del>{% endif %}
                  </label>
                {% else %}
                  <input type="radio" name="id" value="{{ variant.id }}" id="radio_{{ variant.id }}" disabled="disabled" />
                  <label for="radio_{{ variant.id }}" class="radio">
                    <strong>{{ variant.title }}</strong> is temporarily unavailable
                  </label>
                {% endif %}
               
              </li>
            {% endfor %}</ul>
0 Likes