Show content based on an order for a particular product

Learn how to iterate through your checkout.line_items to see if your special product is in the order.

For example, you want to sell a downloadable product and want to add a download link to the order status page. However, you only want to show the link if the digital product is in the order.


  1. Scroll down to the Additional scripts section.

  2. 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 == 'Downloadable product' %}
        '<p>Download your product <a href="#">Here!</a></p>'
    {% endif %}
  {% endfor %}
  1. Paste the code into the Additional scripts box. (press ctrl + V on a PC or command + V on a Mac)

  2. Complete a test order to view your order status page.

Ready to start selling with Shopify?

Try it free