Delete product title based on variant or line title

Solved
benjamsb
Excursionist
18 3 0

Hello Shopify community,

 

I'm using a custom variants app for my Shopify store, and while it's a great app it does have the drawback of splitting customer orders into two products: the product itself and the variants (listed as "[product name] - Details". I'd like to remove the second product title in my order confirmation emails, as it's creating a lot of confusion for my customers. 
 
I'd like to insert some html code that removes the product title if the variant title contains 'Details.'  Can you advise on what this code looks like and where to insert it. Current code and a screenshot to further illustrate my goal below. 
 
I've spent several hours trying to insert something like {if line_item.title contains 'Details' %} {assign  product.title = ' ' %}, but nothing has worked. Really hope you can provide a solution here. Thank you!
 
 
Current code

 

        <td class="order-list__product-description-cell">
          {% if line.product.title %}
            {% assign line_title = line.product.title %}
          {% else %}
            {% assign line_title = line.title %}
          {% endif %}

          {% if line.quantity < line.quantity %}
            {% capture line_display %} {{ line.quantity }} of {{ line.quantity }} {% endcapture %}
          {% else %}
            {% assign line_display = line.quantity  %}
          {% endif %}

          <span class="order-list_<br/>_item-title">{{ line_title }}<br/>

{% if line.variant.title != 'Default Title' %}
{% assign variantOptions = line.variant.title | split: ' / ' %}
  {% for option in variantOptions %}
    <span class="order-list__item-variant"  style="color: #3d4246;"><br/>{{ option }}

 

 

Here's an illustration of what I'm looking to do:

image.png

 

 

0 Likes
benjamsb
Excursionist
18 3 0

This is an accepted solution.

Solved this one with a forloop. Please note that my customers always order one product at a time and this would not be ideal for stores where multiple different products are purchased in the same order.

 

<td class="order-list__product-description-cell">
          {% if line.product.title %}
            {% assign line_title = line.product.title %}
          {% else %}
            {% assign line_title = line_title %}
          {% endif %}

{% if forloop.first == false %}
 {% assign line_title = 'Details' %}
{% endif %}

          {% if line.quantity < line.quantity %}
            {% capture line_display %} {{ line.quantity }} of {{ line.quantity }} {% endcapture %}
          {% else %}
            {% assign line_display = line.quantity  %}
          {% endif %}

          <span class="order-list_<br/>_item-title">{{ line_title }}
0 Likes