As the title says, when inputting a product I would like to add the Variants the are in each product to show up on the Product Card. As of now every item is a single item, and I only have one of each item in stock. I would like to pull the Size and Condition variant from each item so that it looks like the image attached. Is there any way to do that?
Hey @TzviDubrawsky ,
Welcome to Shopify community.
If you want to show the product variants on the product card then you need to do custom code.
Could you please share the store URL so that I can take a look and provide you with the solution code based on the current theme.
Hi @TzviDubrawsky that can be done with an advanced theme customization that will vary wildly by theme and wanted outcome.
The simplest approach for single-variant products is of course to just put the product-option info into the title itself.
If you need this customization then contact me for services.
Contact info in forum signature below
.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.
Hey! @TzviDubrawsky ,
Could you kindly share your store URL and password (if it’s password-protected) so I can review it and provide you with an update?
Hello @TzviDubrawsky ,
Yes it’s possible.
Please use this code
{% assign variantCount = product.variants | size %}
{% assign variantlength = product.variants | length %}
{% if product.available and variantCount > 0 %}
{% for option in product.options %}
{% assign is_size = false %}
{% assign downcased_option = option | downcase %}
{% if downcased_option contains 'size' or downcased_option contains 'length' %}
{% assign option_index = forloop.index0 %}
{% assign option_count = 0 %}
{% assign values = '' %}
{% for variant in product.variants %}
{% assign value = variant.options[option_index] %}
{% unless values contains value %}
{% if option_count > 0 %}
{% assign values = values | join: '|' | append: '|' %}
{% endif %}
{% assign values = values | append: value %}
{% assign values = values | split: '|' | sort %}
{% assign option_count = values | size %}
{{value}}
{% assign option_count = option_count | plus : 1 %}
{% endunless %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
Note: You need to do css a/to your need.
Regards
Guleria
Sorry I am relatively new to this, where do I place this code?
Not an issue, you can contact for services.
You can find contact info in the signature below.