I’m working on a shopify app, and I’m building a filter system to filter products by availability of variants from the collection page, i.e. color, size, etc.
I have the variants put into a hidden span tag on the collection page, but it always returns an info hash, instead of a variant name.
span tag:
<span>
{% for variant in product.variants %}
{{ variant }}
{% endfor %}
</span>
But instead of returning useful things like ‘red’, ‘black’, ‘blue’, it returns this:
<span>
"#"
<productvariantdrop:0x00000003dee880></productvariantdrop:0x00000003dee880>
</span>
Any one know whats going on here?
simple. {{variant}} is an object. Obviously of type productvariantdrop. If you want the variant options, you will have to dig deeper and expose them via the iterator on the options. See the docs for variant to tell you more. Example http://docs.shopify.com/api/product_variant and variant.options.