Order confirmation email - content based on payment type

Hello,

I’m wanting to change a line of text based on what payment method was used? I have a custom payment option which I want to identify.

Is there a simple way of doing this please?

Thanks!

Hi ElliottF,

I understand you want to make changes on your Order confirmation email?

You can type something like this on the email body where you want to show the line of text:

{% for transaction in transactions %}
{% if transaction.gateway_display_name == ‘Cash on Delivery (COD)’ %}

//type line of text

{% else %}

//type line of text

{% endif%}
{% endfor %}

In this example, the payment method used is Cash on Delivery (COD).

Hi @ElliottF

You can use this pieace of code in your email templates to add custom text or HTML for a specific payment method:

{% assign _is_my_payment_method = false %}
{% for transaction in transactions %}
   {% if transaction.gateway == '{YOUR PAYMENT METHOD NAME HERE}' %}
      {% assign _is_my_payment_method = true%}
   {% endif%}
{% endfor %}

{% if _is_my_payment_method == true %}
  {INSERT HERE YOUR CUSTOM HTML FOR THE PAYMENT METHOD}
{% endif %}

Hope this helps!

1 Like

Hi!! @MarcoReleasit

I also need to change order confirmation email, depending on the payment method.

My payment method are:

Tarjeta de Crédito

Bank Deposit

I inserted your code, but it did not work for, where exactly should it go?

Code:

{% capture email_title %}Thank you for your purchase! {% endcapture %}
{% capture email_body %}
{% if requires_shipping %}
{% case delivery_method %}
{% when ‘pick-up’ %}
You’ll receive an email when your order is ready for pickup.
{% when ‘local’ %}
Hi {{ customer.first_name }}, we’re getting your order ready for delivery.

{% else %}
Hi {{ customer.first_name }}, we’re getting your order ready to be shipped. We will notify you when it has been sent.
{% endcase %}
{% if delivery_instructions != blank %}

Delivery information: {{ delivery_instructions }}

{% endif %} {% endif %} {% endcapture %}

Thank you!!

Carolina

Hello @LaseMakers

In your specific case if you want to show a message for Bank Deposit here’s the snippet code that you sent me with my code in it:

{% capture email_title %}Thank you for your purchase! {% endcapture %}
{% capture email_body %}
{% if requires_shipping %}
{% case delivery_method %}
{% when 'pick-up' %}
You’ll receive an email when your order is ready for pickup.
{% when 'local' %}
Hi {{ customer.first_name }}, we're getting your order ready for delivery.

{% else %}
Hi {{ customer.first_name }}, we're getting your order ready to be shipped. We will notify you when it has been sent.
{% endcase %}
{%- assign _is_my_payment_method = false -%}
{%- for transaction in transactions -%}
   {% if transaction.gateway == 'Bank Deposit' %}
      {% assign _is_my_payment_method = true%}
   {% endif%}
{%- endfor -%}
{% if _is_my_payment_method == true %}
  

{INSERT HERE YOUR CUSTOM HTML FOR THE PAYMENT METHOD}

{% endif %}
{% if delivery_instructions != blank %}

**Delivery information:** {{ delivery_instructions }}

{% endif %}
{% endif %}
{% endcapture %}

You can add your custom message by replacing the “{INSERT HERE YOUR CUSTOM HTML FOR THE PAYMENT METHOD}” string!

Hope this helps!

Marco

1 Like

Thank you for this Marco,

But not sure it this will solve what I want to do.
So example in the email for that row:

Payment method: XXXXXX

Where the “XXXXXX” i want to replace with a snippet that shows the selected payment method the payment step in the checkout.
So if I choose “Klarna” it should say:
Payment method: Klarna

Is this possible to catch with a snippet?
I have the Shopify Payments activated and also PayPal.

Hi,

did you ever figure out how do do this?