Remove link to product page based on variant title or line title item title

Solved
benjamsb
Excursionist
18 3 0

Hi Shopify community,

 

For every product purchased on my store, my order confirmation email provides a link to the respective product page. I'd like to remove that link if the product variant title or line item title contains the word "Details". I'd greatly appreciate anyone who can show me the html code needed for this, and where to insert it in my order confirmation template. 

The screenshot below should illustrate my goal. Currently, customer orders are split into two products: the product itself and the product variants. I use a third-party app for custom variants, hence the product being split into two products. I'd like to keep the first product link, but remove the second product link at the bottom, since it doesn't actually link to the relevant product.

Current order confirmation html listed as well. Thank you for any assistance you can provide.

 

Screenshot

view tasting menus duplicate.jpg

 

 

Current order confirmation html

   <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 }}

</span>
 {% endfor %}
{% endif %}
<br/>

{% for p in line.properties %}
  {% if p.last contains ' | ' %}
    {% assign parts = p.last | split: ' | ' %}
    {% capture pLast %}
{% for part in parts %}
  {% unless part contains '$' %}
    {{ part }}<br/>
  {% endunless %}
{% endfor %}
    {% endcapture %}
  {% else %}
    {% assign pLast = p.last | append: <br/> %}
  {% endif %}
  <br/><br/><span class="order-list__item-variant" style="color: #3d4246;">{{ p.first }}: <br/>{{ pLast }}</span>
{% endfor %}

<br/>
<br/>
<a href={{shop.url}}{{line.product.url}}><b><u>View Tasting Menus</u></b></a><br/>
<br/>
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.

 

  {% if forloop.first == true %}
<br/>
<a href={{shop.url}}{{line.product.url}}><b><u>View Tasting Menus</u></b></a>
<br/>
<br/>
  {% endif %}

 

0 Likes