Skip to content

Instantly share code, notes, and snippets.

@alxpck
Created April 21, 2017 19:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alxpck/e959f53383397ee03cff8bf3dc97f01d to your computer and use it in GitHub Desktop.
Save alxpck/e959f53383397ee03cff8bf3dc97f01d to your computer and use it in GitHub Desktop.
Testing liquid variables on Teachable
<!--
Email template: student/purchase_notification
Description: This email is sent to a student when they enroll in a course.
-->
<!-- Email Title -->
<div class="header-title">
<h1>{{text.email_receipts.thank_you_for_enrolling_in }} {{sale.course.name }}</h1>
</div>
<!-- Content -->
<p>Welcome, {{ text.user.name }}. try (text.user.name)</p>
<p>Welcome, {{ user.name }}. try (user.name)</p>
<p>We've set up your account.</p>
<p>Your username is: {{ user.email }} try (user.email )</p>
<p>Your username is: {{ text.user.email }} try (text.user.email )<br>
Your temporary password is: Mh9Zw979D2bSHYug</p>
<p>Please change the password as soon as you log in.</p>
<p>To get started, click the button below. Follow the simple steps, and you're in.</p>
<p class="text-center"><a href="https://sso.teachable.com/secure/113985/users/sign_in?clean_login=true&reset_purchase_session=1" class="btn-primary">Click here to log in</a></p>
<br><hr><br>
{% unless sale.free? or sale.payment_method == 'external' %}
<h1 class="price-jumbo">{{ sale.receipt_formatted_charge }}</h1>
<table class="data-table" cellpadding="0" cellspacing="0">
<tr>
<td width="50%">{{text.email_receipts.receipt_number}}</td>
<td class="text-right">{{sale.id}} </td>
</tr>
<tr>
<td width="50%">{{text.email_receipts.product_id}}</td>
<td class="text-right">{{product.id}}</td>
</tr>
<tr>
<td width="50%">{{text.email_receipts.course_name}}</td>
<td class="text-right">{{sale.course.name}}</td>
</tr>
<tr>
<td width="50%">{{text.email_receipts.purchase_date}}</td>
<td class="text-right">{{sale.purchase_date}} {{text.email_receipts.utc}}</td>
</tr>
<tr>
<td width="50%">{{text.email_receipts.purchaser}}</td>
<td class="text-right">{{to.name}}<br><a href="mailto:{{to.email}}">{{to.email}}</a> </td>
</tr>
{% if sale.vat_tax_id %}
<tr>
<td width="50%">{{text.email_receipts.purchaser_vat_id}}</td>
<td class="text-right">{{ sale.vat_tax_id }}</td>
</tr>
{% endif %}
<tr>
<td width="50%">{{ text.email_receipts.vendor }}</td>
<td class="text-right">{{ school.name }}<br><a href="{{school.url}}">{{school.url}}</a> </td>
</tr>
{% if sale.vendor_vat_id %}
<tr>
<td width="50%">{{ text.email_receipts.vendor_vat_id }}</td>
<td class="text-right">{{ sale.vendor_vat_id }}</td>
</tr>
{% endif %}
<tr>
<td width="50%">{{text.email_receipts.list_price}}</td>
<td class="text-right">{{sale.receipt_list_price}}</td>
</tr>
{% if sale.discounted? %}
<tr>
<td width="50%">{{text.email_receipts.discount }} ({{sale.coupon_code}})</td>
<td class="text-right">{{sale.receipt_discount_amount }}</td>
</tr>
{% endif %}
{% if sale.taxed? %}
<tr>
<td width="50%">{{ text.email_receipts.tax }}</td>
<td class="text-right">{{ sale.receipt_tax_amount }}</td>
</tr>
{% endif %}
<tr class="total">
<td width="50%">{{text.email_receipts.total }}</td>
<td class="text-right">{{ sale.receipt_formatted_charge }}</td>
</tr>
</table>
{% endunless %}
<!-- Auto-generated JSON-ld compliant JSON for showing action buttons in emails -->
<script type="application/ld+json">{{ goto_action_json }}</script>
@paulmil11
Copy link

hey where did you find all the teachable liquid codes? the list teachable offers is missing a bunch of these

@alxpck
Copy link
Author

alxpck commented May 11, 2020

@paulmil11 Honestly, I don't remember.

Looking at this gist I feel like I copy/pasted from somewhere else to keep it as a note-to-self.

I remember having so much difficulty working with the teachable liquid codes.

I may have pulled a shopify template and tried brute forcing these codes since it seemed there was overlap where teachable had followed shopify's naming schemes.

Sorry, I wish I could say with more certainty.

@paulmil11
Copy link

haha same @alxpck - thanks for responding

@alxpck
Copy link
Author

alxpck commented May 15, 2020

👍🏼

@noman26636
Copy link

there is this liquid variable name "Course" in teachable how do we get those liquid variables.
Like for say I want to get the course name. How will we do it?

@alxpck
Copy link
Author

alxpck commented Aug 5, 2022

Hey sorry @noman26636 I don't know.

I either pulled these from a liquid template I found on a marketplace that referenced them OR I reverse-engineered these codes with trial and error. It's been so long I don't remember how I did it—I'm not using Teachable as a platform anymore so I'm not up-to-date.

Wish I could offer more guidance. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment