Link back to specific product page in confirmation email

Hi there,

I’d like to modify the confirmation email to include a link back to the specific product ordered by the customer.

So for example, I could say in the email: “View the product here” and then there would be a link back to the product.

This needs to be dynamic, to update the URL based on the product the customer ordered.

Any ideas? Thanks.

1 Like

Hi,

Assuming your confirmation message is the same as mine, the line item for the product itself is in a variable called line_title. You want to wrap that in an tag. The hard part was figuring out what the liquid objects are, because they’re not documented. What worked for me was {{ line.url }}. That gives you the relative link to the variant that the customer purchased. Since it’s a relative link, you need to add your website. You can use {{ shop.url }}{{ line.url }} just like that, no space between them.

Good luck. If you need more detailed instructions, just ask.

-J.

Hi J, thank you for the response!

Here is the email code where it mentions line_title. What part of this would be wrapped and how so? I appreciate the help.


  {% for line in subtotal_line_items %}
  {% endfor %}
<table>

    
      <table>

        <td>

          {% if line.image %}
            
          {% endif %}
        

</td>

        <td>

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

          {{ line_title }} × {{ line_display }}

          {% if line.variant.title != 'Default Title' %}
            {{ line.variant.title }}

          {% endif %}

          {% if line.selling_plan_allocation %}
            {{ line.selling_plan_allocation.selling_plan.name }}

          {% endif %}

          {% if line.refunded_quantity > 0 %}
            Refunded
          {% endif %}

          {% if line.discount_allocations %}
            {% for discount_allocation in line.discount_allocations %}
              {% if discount_allocation.discount_application.target_selection != 'all' %}
                
                  
                  
                    {{ discount_allocation.discount_application.title | upcase }}
                    (-{{ discount_allocation.amount | money }})
                  
                
              {% endif %}
            {% endfor %}
          {% endif %}
        

</td>

          
            {% if line.original_line_price != line.final_line_price %}
              <del>{{ line.original_line_price | money }}</del>
            {% endif %}
            

              {% if line.final_line_price > 0 %}
                {{ line.final_line_price | money }}
              {% else %}
                Free
              {% endif %}
            

          
      </table>
    
  </table>

Thanks again, J! Was able to figure it out.

For anyone else with this issue…this (this is the code from the order confirmation template):

{{ line_title }} × {{ line_display }}

Should turn into this:

{{ line_title }} × {{ line_display }}

2 Likes

You got it! Well done!

Hi Sayprojects, I would like to know where would you put that? On the Add link? or do I have to go to edit them edit to add it?

I went to Settings > Notifications > Scrolled down to the email I wanted to edit > Clicked the title > Clicked the top right button ‘edit code’ > then pasted the code as described above. Hope this helps!