Shopify themes, liquid, logos, and UX
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Seeking a way to Make "Size Variant" icons for size instead of buttons. For custom Product template.
Hi @mgerard85 ,
This is Amelia from PageFly - a Landing Page Builder App
To create “Size Variant” icons instead of buttons for your custom product template, you can follow these steps:
Edit Your Theme Code:
Modify the Product Template:
{% for option in product.options_with_values %} {% if option.name == 'Size' %} <div class="size-variants"> {% for value in option.values %} <label> <input type="radio" name="size" value="{{ value }}"> {{ value }} </label> {% endfor %} </div> {% endif %} {% endfor %}
Add CSS for Icons:
.size-variants label { display: inline-block; width: 40px; height: 40px; background-color: #f0f0f0; border-radius: 50%; text-align: center; line-height: 40px; margin: 5px; cursor: pointer; } .size-variants input[type="radio"] { display: none; } .size-variants input[type="radio"]:checked + label { background-color: #000; color: #fff; }
Customize Icons:
{% for value in option.values %} <label> <input type="radio" name="size" value="{{ value }}"> <img src="/path/to/{{ value | downcase }}-icon.svg" alt="{{ value }}"> </label> {% endfor %}
I hope that my solution works for you.
Best regards,
Amelia | PageFly
Please let me know if it works by giving it a Like or marking it as a solution!
➜ Optimize your Shopify store with PageFly Page Builder (Free plan available)
➜ Weekly updated Shopify tutorials on YouTube
All features are available from Free plan. Live Chat Support is available 24/7.