Use variant title from customer order

Kronos9326
New Member
5 0 0

I have a page that loops through a customers order history looking for products that will display when the conditions are met. Below is the code I am using.

item.title will display the product name and the variant name combined, but I only want the variant name.

Is there a way to use ONLY the variant name when running through an order history? I've not been able to find a way to identify that object.

 {% if item.variant.metafields["global"]["Title-Name"] %}
<div class="down-variant-title"><span style="font-size:small">{{ item.title }}</span></div>
<div class="down-title">{{ item.variant.metafields["global"]["Title-Name"]}}</div>
{% else %}
<div class="down-title">{{ item.product.title }}</div>
{% endif %}

 

0 Likes