Variables for Email Notifications and Scripts

Warning: This feature will require advanced Shopify liquid, and possibly HTML and JavaScript knowledge. This is not part of ReCharge's standard turnkey solution. This feature is not supported by ReCharge as per our design policy since it requires custom coding. This documentation is meant to be used as a reference in order for you, your team, or a recommended third-party developer to accomplish.

ReCharge is a Python app and we use Jinja2, the Python Template Engine. You can use this list of built-in features.

Here's a list of variables you can use within email templates. Must be in the following example format: {{email}}

  • first_name
  • last_name
  • email
  • order_number  
  • order_name  
  • id (This is for the Shopify Order ID)  
  • subtotal_price  
  • total_price  
  • total_discounts (This is the amount off you get in your order, so if the discount was 50% off and the subtotal was $10, then the total discounts is $5)
  • discount  
  • discount_code (This will store the actual discount string for your discount 'HALFOFF' for example.)
  • discount_type
  • total_tax
  • tax  
  • tax_line.title
  • tax_line.price
  • total_shipping  
  • shipping  
  • charge_date - The date of the upcoming scheduled charge. Example: {{ charge_date | date: (%b %d, %y) }}
  • browser_ip  
  • ip_address  
  • customer  
    • customer.shopify_customer_id
  • total_weight  
  • billing_address  
  • shipping_address
    • shipping_address.first_name
    • shipping_address.last_name
    • shipping_address.address1
    • shipping_address.address2
    • shipping_address.province

  • shipping_lines
  • out_of_stock_items
  • days
  • refund_amount (Amount referenced on the Refund Notification email)

There are other variables you can use that are related to the items in the purchase. However, to use those kind variables, you must go through line_itemswithin a loop. Here is a list of the variables available in line_items.

Email Templates (Not on the Thank You page):

  • link (The Standard link that goes to the Customer Portal)
  • billing_link (Goes straight to the update card page on the Customer Portal.)
  • delivery_schedule_link (Goes straight to the delivery schedule page on the Customer Portal.)

Item Lines Variables (Loop needed):

  • fulfillment_service
  • grams  
  • name  
  • price
  • product_id 
  • product_title
  • quantity  
  • sku    
  • title  
  • variant_id
  • variant_title

In order to use these variables, you should use them within a loop like the following example:

{% for item in line_items %}
{{ item.product_title }}
{% endfor %}

Note: The conditional IF structure causes the shipping interval to be printed only if it's a subscription product.

Displaying Line Item Properties

{% for line_item in line_items %}
{% if %}
{{ }
{% endif %}
{% endfor %}
While 'keyname' is a placeholder for whatever the key of the property is set to. The IF statement is important so it doesn't interfere with ReCharge if the property is not present on the order.

Additional Content & Scripts

To test render the Contents & Scripts section for a specific order you can use the following URL syntax. There's a Preview link in the checkout settings area.:{{id}}<br>
It can be used to validate the structure, but there‚Äôs no way to actually preview a Thank You page, based on a past order, for example. To see actual Thank You page you need to run a test order and save that URL and always use in future.

You can get variables on the item level as well using a for loop like:   

{% for item in line_items %<gs id="a82a4c5e-8104-48b8-b9f2-8c924b9479c5" ginger_software_uiphraseguid="5ecffd94-61b8-41b1-b869-43f27696b0f7" class="GINGER_SOFTWARE_mark">}</gs>{{item<gs id="5c45722c-0769-40bf-a74b-001e10442464" ginger_software_uiphraseguid="5ecffd94-61b8-41b1-b869-43f27696b0f7" class="GINGER_SOFTWARE_mark">.</gs><gs id="527f30ee-942d-458e-a5f1-bd74bd188d5c" ginger_software_uiphraseguid="5ecffd94-61b8-41b1-b869-43f27696b0f7" class="GINGER_SOFTWARE_mark">sku</gs>}}, {% <gs id="6a2aa5c2-bb8f-42bf-8803-72e26a1ee854" ginger_software_uiphraseguid="5ecffd94-61b8-41b1-b869-43f27696b0f7" class="GINGER_SOFTWARE_mark">endfor</gs> %}

First-Time Load

If you want the scripts to only render the first time the page is loaded you can use the following lines of code. If you append  show_scripts=true in the checkout URL, you can force it to still show for debugging purposes.

{% if first_time_load %}
{% endif %}

Debugging and Common Issues

When copying over the liquid code from the Shopify checkout, there are some differences in the variables to be aware of.

  1. When looping through items make sure it's {% for line_item in line_items %} not {% for line_item in order.line_items %}
  2. Shopify only ever has one discount per order so take out all discount loops. Use {{ discount_code }} instead
  3. Remove all filters like "| money_without_currency"

Still stuck? How can we help? Still stuck? How can we help?