Show content only when a particular product has been ordered


This is an advanced tutorial and is not supported by Shopify. Knowledge of web design languages such as HTML, CSS, Javascript and Liquid is required. We suggest hiring a Shopify Expert if you are not comfortable proceeding with the following tutorial.

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 their download link to the order status page, but only show the link if the digital product is in the order.

  1. Scroll down to the Additional Content & 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 == 'Our special downloadable product' %}
  <p>Download your special downloadable product <a href="#">here</a>.</p>
  {% endif %}
{% endfor %}

  1. Paste the code into the Additional Content & 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:

Thank you 4

Want to discuss this page?

Visit the Shopify Community