Solved

Which line removes swatches in this code?????

ebon
Pathfinder
115 3 41

 

I was given code to add the number of colors a product is available in the Dawn theme BUT it also displays swatches which I don't want. I asked the coder to remove it and this is what I got back.

If you don't want swatches you can just remove the line with the image or have that option in the no swatches section. you are welcome. good luck!

I'm no coder and I can't see the word IMAGES in this code anywhere. Can someone please point out what I should be removing please. Thank you

 

 

the sample url given to me to see the code below is https://makeoutstore.com/collections/one-pieces 

 

 

 {% if product_card_product.options contains 'Pattern' 
        or product_card_product.options contains 'Color'
        or product_card_product.options contains 'Drawing'
        or product_card_product.options contains 'Number'
    %}
   
      {%- assign pattern_label = 'pattern,Pattern,color,Color,Colour,colour,Drawing,drawing,number,Number' | split: ',' -%}
        {%- for option in product_card_product.options_with_values -%}
            {%- assign downcased_option = option.name | downcase -%}
            {%- if pattern_label contains downcased_option -%}
            {%- assign variant_option = 'option' | append: forloop.index -%}
            <div class="design-count-swatches">  
              {%- for value in option.values -%}    
                    
                  {%- for variant in product_card_product.variants -%}
                    {%- if variant[variant_option] == value -%}
                    {%- assign handle_value = value | handleize -%}
                      {% assign prodcard_variant_pattern_values = prodcard_variant_pattern_values | append: handle_value | append: ':' %}
                    {%- endif -%}
                  {%- endfor -%}  
                  {% if product_card_product.options contains 'Pattern' or product_card_product.options contains 'Color'%} 
                      <img src="{{ handle_value | append: '.gif' | asset_url }}" alt="{{ value }}" width="16" height="16" />
                  {% endif %}
              {%- endfor -%}
           
            {%- endif -%}  
                    
            {% assign prodcard_variant_pattern_values_unique = prodcard_variant_pattern_values | split: ':' | uniq | join: ',' %}
            {% assign prodcard_variant_pattern_values_unique = prodcard_variant_pattern_values_unique | split: "," %}
        {%- endfor -%}
      </div>
        {%- if prodcard_variant_pattern_values_unique.size > 1 -%}
              <span class="product_card_count">{{prodcard_variant_pattern_values_unique.size }} 
                {% if product_card_product.options contains 'Pattern'%}Patterns{% endif %}
                {% if product_card_product.options contains 'Number'%}Numbers{% endif %}
                {% if product_card_product.options contains 'Drawing'%}Drawings{% endif %}
                {% if product_card_product.options contains 'Color'%}Colors{% endif %}  
                Available</span>
        {%- endif -%}
        {%- endif -%}

 

 

Accepted Solution (1)

JHKCreate
Shopify Expert
3571 639 916

This is an accepted solution.

Hi @ebon 

The only image reference here is under img  which is this line:

<img src="{{ handle_value | append: '.gif' | asset_url }}" alt="{{ value }}" width="16" height="16" />


Try removing that and see if that works.

Should that help answer your query, we always appreciate liking & marking an as answer to let the community find quality solutions faster. Thanks!

Did we solve your issue? Like & Mark As Solution to help the community
Should you need any direct help: contact@jhkcreate.com

Learn more about us: jhkcreate.com

View solution in original post

Replies 2 (2)

JHKCreate
Shopify Expert
3571 639 916

This is an accepted solution.

Hi @ebon 

The only image reference here is under img  which is this line:

<img src="{{ handle_value | append: '.gif' | asset_url }}" alt="{{ value }}" width="16" height="16" />


Try removing that and see if that works.

Should that help answer your query, we always appreciate liking & marking an as answer to let the community find quality solutions faster. Thanks!

Did we solve your issue? Like & Mark As Solution to help the community
Should you need any direct help: contact@jhkcreate.com

Learn more about us: jhkcreate.com
ebon
Pathfinder
115 3 41

It worked. Thank you so much.