Shopify themes, liquid, logos, and UX
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!
Solved! Go to the solution
This is an accepted solution.
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!
This is an accepted solution.
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 %}
<p>{INSERT HERE YOUR CUSTOM HTML FOR THE PAYMENT METHOD}</p>
{% endif %}
{% if delivery_instructions != blank %}
<p><b>Delivery information:</b> {{ delivery_instructions }}</p>
{% 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
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).
This is an accepted solution.
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!
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 %}
<p><b>Delivery information:</b> {{ delivery_instructions }}</p>
{% endif %}
{% endif %}
{% endcapture %}
Thank you!!
Carolina
This is an accepted solution.
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 %}
<p>{INSERT HERE YOUR CUSTOM HTML FOR THE PAYMENT METHOD}</p>
{% endif %}
{% if delivery_instructions != blank %}
<p><b>Delivery information:</b> {{ delivery_instructions }}</p>
{% 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
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?
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024