We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Customising email notification for gift card with conditional message

Solved

Customising email notification for gift card with conditional message

SFW
Excursionist
16 0 3

Hello, I am running a webstore selling footwear which allows users to select a "Not Sure" size option if they are not sure of the size of the footwear. Those who purchase the "Not Sure" size option would receive a sizing kit and a gift card that could be used to offset their purchase once they have determined the size of the footwear.

 

I've created a shopify flow process (see below) that allows me to send a gift card via email to those who purchase the "Not Sure" size variant, however, I would also like to insert a custom message in the gift card notification that is based on conditional logic.

 

I have tried the following code in the new gift card template- 2 methods, 1 using the note field with the note inserted into the gift card. The other using the customer tags field. However, both don't seem to be working. Was wondering if anyone had any success with customising gift card templates to show a message based on a condition. Any form of help is appreciated, thanks!

 

<!-- Method 1-->

{% if gift_card.note contains "Not Sure" %}
<p style="font-size: 16px; margin-bottom: 20px;">
Thank you for your purchase! Kindly use this gift card to offset your purchase once you've used the sizing kit to confirm the child's size.
</p>
{% endif %}

 

<!-- Method 2-->

{% if customer.tags contains "NotSureGiftCard" %}
<p>Thank you for your purchase! Kindly use this gift card to offset your purchase once you've used the sizing kit to confirm the child's size.</p>
{% endif %}

 

 

SFW_1-1750377288479.png

 

 

 

Accepted Solution (1)

tim
Shopify Partner
4812 598 1733

This is an accepted solution.

The solution is in https://community.shopify.com/c/shopify-flow-app/automatically-issue-digital-gift-card-post-purchase... 

 

Briefly -- card_note does not work because it's not available in Liquid;

customer tag does not work because in Gift card context customer is the person who've purchased the card while the person for whom this card is intended is a recipient.

So the code should be like 

{% if recepient.tags contains "NotSureGiftCard" %}
  <p>...</p>
{% endif %}
If my post is helpful, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com

View solution in original post

Replies 2 (2)

tim
Shopify Partner
4812 598 1733

This is an accepted solution.

The solution is in https://community.shopify.com/c/shopify-flow-app/automatically-issue-digital-gift-card-post-purchase... 

 

Briefly -- card_note does not work because it's not available in Liquid;

customer tag does not work because in Gift card context customer is the person who've purchased the card while the person for whom this card is intended is a recipient.

So the code should be like 

{% if recepient.tags contains "NotSureGiftCard" %}
  <p>...</p>
{% endif %}
If my post is helpful, hit the thumb up button -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com
SFW
Excursionist
16 0 3

For those browsing for the solution, here it is courtesy of Tim

First, create the following process in flow

 

SFW_0-1750399639827.png

 

Then, enter the details in the Send Admin API Request (GiftCardCreate mutation) - the solution was calling the field "templateSuffix: "

SFW_1-1750399665335.png

 

Lastly, insert the following liquid code in your gift card notification email template

 

{% if gift_card.template_suffix == "not-sure" %} <p style="font-size: 16px; margin-bottom: 10px;"> Thank you for your purchase! Kindly use this gift card to offset... </p> {% endif %}