Adding Product name to New Gift Card template

Topic summary

A Shopify user is attempting to add product names to the “New Gift Card” notification template using Liquid code but encountering issues.

The Problem:

  • Cannot find product-related Liquid variables specifically for gift cards in the documentation
  • Attempted to loop through subtotal_line_items to extract product information
  • The implemented code is not functioning as expected

Code Approach:
The user tried accessing line item data with conditional logic:

  • Checking if line.product.title exists
  • Assigning it to a variable and displaying it
  • Looping through items in a table structure

Additional Question:
Asked whether there’s a Liquid equivalent to PHP’s print_r() function for debugging—a way to output arrays of available items/variables on the page to see what data is accessible.

The discussion remains open, awaiting community guidance on the correct Liquid variables or methods for accessing gift card product information in notification templates.

Summarized with AI on November 12. AI used: claude-sonnet-4-5-20250929.

Hi,

I’m relatively new to Shopify liquid and I am trying to add the product name to the “New Gift Card” template under notifications.

I looked through the liquid variables and couldn’t see any product information related to Gift Cards, so I used the following code in the template but it doesn’t appear to be working.

Anyone got any suggestions?

<table align="center" class="row giftcard__topmargin">

{% for line in subtotal_line_items %}
    <tr> 
      <td>
          {% if line.product.title %}
            {% assign line_title = line.product.title %}
          {% else %}
            {% assign line_title = line.title %}
          {% endif %}

          {{ line_title }} 
      </td>
    </tr>
{% endfor %}
  
</table>

Also, just as a side quest question, in PHP, for example, I can use print_r() to print out an array of items that I can use on the page, is there an equivalent in liquid? For example, could I print_r(subtotal_line_items)?