Show content on the order status page based on which products are ordered

This will show you how to iterate through your checkout.line_items to see if your special product is in the order.

For example, Jane sells a downloadable product and wants to add her download link to the Thank You page, but only show the link if the digital product is in the order.

  1. From your Shopify admin, click Settings, then click Checkout.

  2. Find the Additional content & scripts section.

  3. Copy the following code to your clipboard (command + c on a Mac, ctrl + c on a PC).

{% for line in checkout.line_items %}
  <!-- DEBUG looking at {{ line.title }} -->
  {% if line.title == 'Our special downloadable product' %}
  <p>Download your special downloadable product <a href="#">here</a>.
  {% endif %}
{% endfor %}

  1. Paste the code into the Additional Content & scripts box. (command + v on a Mac, ctrl + v on a PC)

  2. Complete a test order to view your Thank You page:

Thank you 4

Want to discuss this page?

Visit the Shopify Community