Re: Modifying Order Printer Template to exclude Authorization Transactions

Solved

Modifying Order Printer Template to exclude Authorization Transactions

FairWind
Excursionist
23 1 1

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:

 

Capture.JPG

 

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 %}

 

 

Accepted Solution (1)

MakP
Shopify Partner
33 9 13

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 %}

 

View solution in original post

Replies 3 (3)

FairWind
Excursionist
23 1 1

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.

 

MakP
Shopify Partner
33 9 13

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 %}

 

FairWind
Excursionist
23 1 1

That's excellent, thanks very much!