Variant not updating price

Highlighted
Tourist
3 0 0

Hey all, 

I tried changing the code of the product-template layout, which seemed to be working quite well until I saw that the variant price was not updating anymore. This is the relevant piece of code within the form I'm using (i customised the label and select tags because this way it fits the theme I'm building for my client better):

 

 

<div class="product-form__controls-group">
    <div class="selector-wrapper js product-form__item">
        <label for="SingleOptionSelector-{{ forloop.index0 }}">
                                    Material
        </label>
        <select class="single-option-selector single-option-selector-{{ section.id }} product-form__input" id="SingleOptionSelector-{{ forloop.index0 }}" data-index="option{{ forloop.index }}">
            {% for option in product.options_by_name['Material'].values %}
                {% for value in option %}
                    <option value="{{ value | escape }}"{% if option.selected_value == value %} selected="selected"{% endif %}>{{ value }}</option>
                 {% endfor %}
             {% endfor %}
         </select>
     </div>
     <div class="selector-wrapper js product-form__item">
         <label for="SingleOptionSelector-{{ forloop.index0 }}">
                                    Size
         </label>
         <select class="single-option-selector single-option-selector-{{ section.id }} product-form__input" id="SingleOptionSelector-{{ forloop.index0 }}" data-index="option{{ forloop.index }}">
             {% for option in product.options_by_name['Size'].values %}
                 {% for value in option %}
                     <option value="{{ value | escape }}"{% if option.selected_value == value %} selected="selected"{% endif %}>{{ value }}</option>
                {% endfor %}
            {% endfor %}
        </select>
    </div>
</div>

 

 

the above piece of code is edited from this piece:

 

<div class="product-form__controls-group">
    {% for option in product.options_with_values %}
        <div class="selector-wrapper js product-form__item">
            <label for="SingleOptionSelector-{{ forloop.index0 }}">
                {{ option.name }}
            </label>
            <select class="single-option-selector single-option-selector-{{ section.id }} product-form__input" id="SingleOptionSelector-{{ forloop.index0 }}" data-index="option{{ forloop.index }}">
                {% for value in option.values %}
                    <option value="{{ value | escape }}"{% if option.selected_value == value %} selected="selected"{% endif %}>{{ value }}</option>
                {% endfor %}
            </select>
        </div>
    {% endfor %}
</div>

 

 

I copied this from the debut theme, and multiple posts with the same question said there was something with the selectCallback script (which I can't find in this theme). If anyone could help me out that would be great.

0 Likes