Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Adding size variants to featured collection

Adding size variants to featured collection

flavourbombs
Visitor
3 0 0

Hello all, I've looked at many different articles about adding size variants/swatches to featured collections and tried some code but to no avail. I'm using refresh theme. Do I need to add something to card-product.liquid? Would love some help! Coding knowledge is slim to none. I only have 3 different sizes for each product and they dont have different images, but they do have different prices. How can I achieve this? 

 

Thank you!

Replies 4 (4)

ProtoMan44
Shopify Partner
615 54 93

@flavourbombs  hey, thanks for posting here.

{% if product.available %}
  <select name="id" id="ProductSelect-{{ section.id }}" class="product-single__variants">
    {% for variant in product.variants %}
      {% if variant.available %}
        <option {% if variant == product.selected_or_first_available_variant %} selected="selected" {% endif %}
          value="{{ variant.id }}">{{ variant.title }}</option>
      {% else %}
        <option disabled="disabled">
          {{ variant.title }} - {{ 'products.product.sold_out' | t }}
        </option>
      {% endif %}
    {% endfor %}
  </select>
{% endif %}

 

- A thirsty developer passionate about supporting the community. If you'd like to, you can  

Buy me a Coffee.


- Your Shopify Solution Specialist Get a Quote at

ProtoMan44

 - 

Chat On Whatsapp


Crafting exceptional e-commerce experiences to elevate your online presence. Let's build your success story together!
flavourbombs
Visitor
3 0 0

Where exactly would I paste this code sorry?

flavourbombs
Visitor
3 0 0

I've tried pasting it into the product card but nothing happened unfortunately. I need a little more guidance! I'd basically like it to look like this so you can select the size right on the homepage:

 Screenshot_20240629_104242_Chrome.jpg

ProtoMan44
Shopify Partner
615 54 93

@flavourbombs in this image, the variant picker already working/.....

- A thirsty developer passionate about supporting the community. If you'd like to, you can  

Buy me a Coffee.


- Your Shopify Solution Specialist Get a Quote at

ProtoMan44

 - 

Chat On Whatsapp


Crafting exceptional e-commerce experiences to elevate your online presence. Let's build your success story together!