Default to "Pick a size"

Excursionist
34 0 6

Hello,

There is probably a rediculosly simple answer, but for some reason when I click on a product, It is always my first size varient that is displayed instead of the "Pick an option" default that I would like. Any suggestions? 

My site is www.angelinavoloshina.com

here is the code that I am using.

 jQuery(document).ready(function($){
    var optionSelectors = new Shopify.OptionSelectors("product-select", { product: {{ product | json }}, onVariantSelected: selectCallback, enableHistoryState: true });
{% if product.options.size == 1 %}
  {% for variant in product.variants %}
    {% unless variant.available %}
    jQuery('.single-option-selector option:eq({{ forloop.index0 }})').attr('disabled', 'disabled');
    {% endunless %}
  {% endfor %}
  jQuery('.single-option-selector').trigger('change');
{% endif %}
    {% if product.variants.size > 1 %}
  {% for option in product.options %}
    $('.single-option-selector:eq({{ forloop.index0 }})')
    .filter(function() { return $(this).find('option').size() > 1  })
    .prepend('<option value="">Pick a ' + {{ product.options[forloop.index0] | json }} + '</option>')
    .val('')
    .trigger('change');
  {% endfor %}
{% endif %}
    // Add label if only one product option and it isn't 'Title'.
    {% if product.options.size == 1 and product.options.first != 'Title' %}
      $('.selector-wrapper:eq(0)').prepend('<label>{{ product.options.first }}</label>');
    {% endif %}

  });

  </script>

1 Like
Shopify Partner
157 0 33

Looks like you fixed the issue, unless it was for a specific product.

0 Likes
Highlighted
Excursionist
34 0 6

Hey Cameron, thanks for the quick reply.

For some reason its only a problem on Iphone and mac, on windows it seems to work fine. Ive cleared the cache multiple times but it still reverts to the first size....any idea of what this can be?

1 Like