Duplicate available sizes on product grid

Solved
Ljkeos
Excursionist
31 0 12

Theme: DEBUT

Website: PPFclothing.com

Password: PPF

Hello,

Recently I have added variants to some of my products. However, this brings up the issue that the available sizes on the product grid show up twice if there are two variants. Here is an example:

Screen Shot 2021-07-23 at 11.05.50 AM.png

Would someone advise me on how I would go about fixing this?

Thank you.

KetanKumar
Shopify Partner
22475 2277 8364

@Ljkeos 

sorry for that  issue.

i have check your whole store but i can't see that issue its all working fine!

if you have issue please mention page url 

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
0 Likes

Please send me the code to display sizes. I will check it.

LitExtension - #1 Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!
0 Likes
Ljkeos
Excursionist
31 0 12

@LitExtension 

Here is the code for displaying sizes on the product grid in product-card-grid.liquid:

  {% if collection.handle == "unique-hoodies" or collection.handle == "t-shirts" or collection.handle == "4x-collection" or collection.handle == "living-in-the-wrong-time"%}
 
    <p>
      {% for option in product.options %}
        {% if option == 'Size' %}
            {% if product.options_with_values[0].name=="Size" %}
                {% for variant in product.variants %}
 
                  {{ variant.option1  }}
 
                {% endfor%}
            {% elsif product.options_with_values[1].name=="Size" %}
                {% for variant in product.variants %}
 
                  {{ variant.option2  }}
 
                {% endfor%}
            {% else %}
                {% for variant in product.variants %}
 
                  {{ variant.option3  }}
 
                {% endfor%}
            {% endif %}
 
        {% endif %}
     {% endfor %}
    </p>
  {% endif %}
  {% include 'product-price-listing', product: product, show_vendor: show_vendor %}

</div>

Let me know if you find a solution!

0 Likes

Please send me the code to display sizes. I will check it.

LitExtension - #1 Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!
0 Likes

This is an accepted solution.

Please change the code:
{% for option in product.options %}
{% if option == 'Size' %}
{% assign option_index = forloop.index0 %}
{% assign values = '' %}
{% for variant in product.variants %}
{% assign value = variant.options[option_index] %}
{% unless values contains value %}
{% assign values = values | join: ',' %}
{% assign values = values | append: ',' | append: value %}
{% assign values = values | split: ',' %}
{{ value | escape }}
{% endunless %}
{% endfor%}
{% endif %}
{% endfor %}
Hope it helps!

LitExtension - #1 Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!
Ljkeos
Excursionist
31 0 12

Awesome-- this worked, thank you!

For future reference, here is the code to display available sizes under products in the product grid:

{% if collection.handle == "unique-hoodies" or collection.handle == "t-shirts" or collection.handle == "4x-collection" or collection.handle == "living-in-the-wrong-time"%}
 
    <p>
      {% for option in product.options %}
{% if option == 'Size' %}
{% assign option_index = forloop.index0 %}
{% assign values = '' %}
{% for variant in product.variants %}
{% assign value = variant.options[option_index] %}
{% unless values contains value %}
{% assign values = values | join: ',' %}
{% assign values = values | append: ',' | append: value %}
{% assign values = values | split: ',' %}
{{ value | escape }}
{% endunless %}
{% endfor%}
{% endif %}
{% endfor %}
    </p>
  {% endif %}
  {% include 'product-price-listing', product: product, show_vendor: show_vendor %}

</div>

Place it at the end of product-card-grid.liquid in snippets. Of course, you will need to change the collection names to collections you want the sizes to show.

0 Likes