Personalized checkout and custom promotions with Shopify Scripts
Hi,
my store allows customers to use store credits to checkout. Customers can then choose to pay the balance via offline payment such as bank transfer.
I recently found out the order confirmation email sending to customers did not show the store credits in the order amount which confused my customers that they will need to pay for the full amount before applying store credits.
I am hoping to update the order confirmation email template to include the store credits usage if there's any. Appreciate if someone can help suggesting how to make these edits on the email template code.
Thank you in advance!!
Hey @FionaCheung,
Provided that you are using the store credits documented by Shopify here, you can actually get this information from the transactions object and use it in your email template.
https://shopify.dev/docs/api/liquid/objects/transaction
I've just added a small snippet to my email, and here's how that show's up when I place an order by redeeming store credit.
{% assign transaction_count = transactions | size %}
{% if transaction_count > 0 %}
<h3>Transaction Details</h3>
{% for transaction in transactions %}
<table class="row">
<tr>
<td><strong>Transaction ID:</strong></td>
<td>{{ transaction.id }}</td>
</tr>
<tr>
<td><strong>Amount:</strong></td>
<td>{{ transaction.amount | money }}</td>
</tr>
<tr>
<td><strong>Created At:</strong></td>
<td>{{ transaction.created_at }}</td>
</tr>
<tr>
<td><strong>Gateway:</strong></td>
<td>{{ transaction.gateway_display_name }}</td>
</tr>
<tr>
<td><strong>Transaction Type:</strong></td>
<td>{{ transaction.kind }}</td>
</tr>
<tr>
<td><strong>Status:</strong></td>
<td>{{ transaction.status_label }}</td>
</tr>
{% if transaction.payment_details.credit_card_company %}
<tr>
<td><strong>Card Type:</strong></td>
<td>{{ transaction.payment_details.credit_card_company }}</td>
</tr>
<tr>
<td><strong>Card Last 4 Digits:</strong></td>
<td>**** **** **** {{ transaction.payment_details.credit_card_last_four_digits }}</td>
</tr>
{% endif %}
<tr>
<td colspan="2"><strong>Receipt:</strong></td>
</tr>
<tr>
<td colspan="2">
<pre>{{ transaction.receipt }}</pre>
</td>
</tr>
</table>
<hr>
{% endfor %}
{% else %}
<p>No transactions found.</p>
{% endif %}
You can further refine this and customise this to match your styling and needs. I've just simply printed out all the details from the transactions object for your reference as a starting point.
Let me know if you need any assistance. We have an app in the space that helps brands give cashbacks on every order through store credit.
> https://apps.shopify.com/dollarback
Best
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025