Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I am migrating over to the new order printer app and trying to make some changes to my order printer invoice template.
At the bottom of the default template for invoices is a list of transactions. So far I have added the customer's credit card brand as well as the last 4 digits of their card, but I'd like to get rid of the 'authorization' transactions since that's just confusing for the customer. With the authorization transactions the bottom section of the invoice looks like this:
One of those transactions is the payment authorization, and the other is the payment capture. I want all transactions to be included except for authorizations.
The code for that section looks like the following, however authorization transactions are still being shown as in the picture above. Any help would be greatly appreciated:
{% for transaction in transactions %}
{% if transaction.type != 'authorization' %}
<tr>
<td>{{ transaction.payment_details.credit_card_company }} ending in {{ transaction.payment_details.credit_card_last_four_digits }}</td>
<td>{{ transaction.amount | money }}</td>
<td>{{ transaction.status }}</td>
</tr>
{% endif %}
{% endfor %}
Solved! Go to the solution
This is an accepted solution.
For your initial question: You already had the right idea - You just need to change "transaction.type" to "transaction.kind".
For the second question: Set up an if statement to output the CC info only when the transaction gateway = "shopify_payments".
This code is working for me:
{% for transaction in transactions %}
{% if transaction.kind != 'authorization' %}
<tr>
<td>
{% if transaction.gateway == 'shopify_payments' %}
{{ transaction.payment_details.credit_card_company }} ending in {{ transaction.payment_details.credit_card_last_four_digits }}
{% else %}
{{ transaction.gateway_display_name }}
{% endif %}
</td>
<td>{{ transaction.amount | money }}</td>
<td>{{ transaction.status }}</td>
</tr>
{% endif %}
{% endfor %}
I also just realized that it will only display information in the first column if there is a credit card company and last 4 digits. I'll need it to also be able to display all other transactions and have a title for them, just not the authorizations as previously requested.
This is an accepted solution.
For your initial question: You already had the right idea - You just need to change "transaction.type" to "transaction.kind".
For the second question: Set up an if statement to output the CC info only when the transaction gateway = "shopify_payments".
This code is working for me:
{% for transaction in transactions %}
{% if transaction.kind != 'authorization' %}
<tr>
<td>
{% if transaction.gateway == 'shopify_payments' %}
{{ transaction.payment_details.credit_card_company }} ending in {{ transaction.payment_details.credit_card_last_four_digits }}
{% else %}
{{ transaction.gateway_display_name }}
{% endif %}
</td>
<td>{{ transaction.amount | money }}</td>
<td>{{ transaction.status }}</td>
</tr>
{% endif %}
{% endfor %}
That's excellent, thanks very much!
We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024