Product variants show as unavailable

nuwud
Shopify Partner
21 1 0

Hi! 

 

So I am experiencing an issue where my product shows as unavailable (despite being available) once a variant is selected. I contacted Shopify and they told me when they tried a different theme (from my customized Brooklyn theme) it worked fine. After turning off all apps it still had the error. They said it had to be in my theme's code. I tried older versions of the products template page in code area and also rolled back the whole theme, too, but no luck. 

I found that my default product template had no issues running that page (when I switched to it in the product settings). I decided to start from that point and did a side-by-side compare of the code (in VS Code) for both my problem template and the default template that  apparently works. I deleted all the code in problem template in Shopify code area and pasted the default template code into it. Then I cut and pasted the differing parts of my problem template's code into that template, refreshing and checking my product page's frontend with each new addition to see which piece of code was breaking it.    

 

I narrowed my issue down to this one chunk of script for swatches below:  

 

 

{% if option.name == 'Color' %}
      <div class="selector-wrapper js product-form__item swatch-container">
        {%- assign optName = 'options' | append: forloop.index -%}
        {%- assign option_values = [optName] | default: option.values -%}
        {%- for value in option_values -%}
        <label class="swatch">
          <input id="SingleOptionSelector-1" class="single-option-selector single-option-selector-{{section.id}} product-form__input" name="{{ option.name }}" type="radio" value="{{ value | escape }}" data-name="{{ option.name }}" data-index="option1" {% if option.selected_value == value %} checked="checked" {% endif %}>
          <span class="swatch-{{value | split: ' ' | first | downcase }}"><i>{{ value | escape }}</i></span>
        </label>
        {% endfor %}
      </div>
    {% else %}

 

 

 

What I don't understand is that it works perfectly fine for other products with no issues. Just for two of my products, each of which only have one color versus the working products, which have several colors.

 

Could someone have a look at this and let me know if anything stands out for them?
I appreciate any help you can give me toward a solution. 

 


 

Kindest Regards,
Nuwud
Replies 4 (4)

LitExtension
Shopify Partner
4860 1001 1125

Hi @nuwud,

Please send your site and if your site is password protected, please send me the password. I will check it.

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
nuwud
Shopify Partner
21 1 0

I'd love to give you access, but this is a client site and they would not want that. 

Kindest Regards,
Nuwud
LitExtension
Shopify Partner
4860 1001 1125

Hi @nuwud,

It will be difficult for anyone to check bugs through just one piece of code for an entire function.

So sorry I can't help you more.

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify

Aaron_Kroontje
Shopify Partner
18 0 11

Any luck getting this sorted? Having a similar problem.