Liquid, JavaScript, themes, sales channels
I am trying to edit the order confirmation notification template so that when my customer pays with the manual payment method (bank transfer), they will receive the bank details to make the payment.
Something seems to not be working, I'm not sure if I am not making the reference correctly as I am not an expert in this.
This is the edited code:
{% capture email_title %} ¡Gracias por tu compra! Amamos tenerte por aquí. {% endcapture %} {% capture email_body %} {% if has_pending_payment %} {% if buyer_action_required %} Cuando se complete el pago, recibirás un correo electrónico de confirmación. {% else %} El pago se está procesando. Recibirás un correo electrónico cuando se confirme el pedido. {% endif %} <!-- NW EDIT SPEI --> {% if unique_gateways[0] == "Transferencia Electrónica vía SPEI" %} <p> ¡Hola!<br> Si decidiste pagar con transferencia bancaria, estos son los detalles:<br> Banco: BBVA<br> CLABE: XXXXXX<br> Te pediríamos que realices la transferencia en los próximos 3 días y nos envíes el comprobante a atencionalcliente@XXXXX.com.mx. También puedes enviar el comprobante vía <a href="https://xx.me/52XXXXXX">WhatsApp al número 52XXXXXX/a>.<br> ¡Gracias! </p> {% endif %} <!-- END OF EDIT --> {% else %} {% if requires_shipping %} {% case delivery_method %} {% when 'pick-up' %} Recibirás un correo electrónico cuando tu pedido esté listo para ser retirado. {% when 'local' %} Hola {{ customer.first_name }}, con este correo confirmamos tu pedido. ¡Estamos listas para prepararlo y sacarte una sonrisa! {% else %} Con este correo confirmamos tu pedido. ¡Estamos listas para prepararlo y sacarte una sonrisa! En un lapso de 1 a 3 días recibirás la notificación por este medio de que tu pedido salió de nuestra bodega. Ahí encontrarás número de guía para rastreo. {% endcase %} {% if delivery_instructions != blank %} <p><b>Información de entrega:</b> {{ delivery_instructions }}</p> {% endif %} {% if consolidated_estimated_delivery_time %} <p> Entrega estimada <b>{{ consolidated_estimated_delivery_time }}</b> </p> {% endif %} {% endif %} {% endif %} {% endcapture %}
Validate assumptions, make a test order and check the output of things being used in conditions
{{ unique_gateways[0] }}
I also think there's just a simple gateway object {{ gateway }}
unique_gateways[0]: {{ unique_gateways[0] }} <br>
unique_gateways: {{ unique_gateways }} <br>
gateway: {{ gateway }} <br>
Save time & money ,Ask Questions The Smart Way
Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Buy Paul a ☕ Coffee for more answers or donate to eff.org
Hey Paul thanks a lot for your help I made the test. this what shopify printed:
unique_gateways[0]: Transferencia Electrónica vía SPEI
unique_gateways: Transferencia Electrónica vía SPEI
gateway: Transferencia Electrónica vía SPEI
Still I
can't figure out why is not working.
Odd ,
Double chechk that all the captures, and ifs are properly nested so that logic isn't short circuiting somewhere.
Could be the diacritics(ó,í) on the characters messing with things though it shouldn't be an issue. might be worth researching if none of the below pans out.
Maybe try doing a contains match.
{% if unique_gateways[0] contains "Transferencia" and unique_gateways[0] contains "SPEI" %}
💣Though of course when doing a contains make sure words like Transferencia/SPEI wouldn't occur for other payment methods creating a false positive.
If still nothing rule out be invisible whitespace as well ???
{% assign unique_gateways_0 == unique_gateways[0] | strip %}
{% if unique_gateways_0 == "Transferencia Electrónica vía SPEI" %}
...
https://shopify.dev/docs/api/liquid/filters/strip
Or just normalize everything being compared as much as possible .
{% assign unique_gateways_0 == unique_gateways[0] | strip | downcase %}
{% assign manual_spei_gateway == "Transferencia Electrónica vía SPEI" | strip | downcase %}
{% if unique_gateways_0 == manual_spei_gateway %}
...
https://shopify.dev/docs/api/liquid/filters/downcase
and if still not working another iteration using a contains condition
{% assign unique_gateways_0 == unique_gateways[0] | strip | downcase %}
{% if unique_gateways_0 contains "transferencia" and unique_gateways_0 contains "spei" %}
Beyond that something has to be being missed as your first code should have worked /shrug.
Save time & money ,Ask Questions The Smart Way
Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Buy Paul a ☕ Coffee for more answers or donate to eff.org
User | RANK |
---|---|
37 | |
29 | |
12 | |
12 | |
8 |
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023