Hello, I have a store that sells shoes with variants as sizes (e.g., 22, 23 etc) and I have included an option of “Not Sure” size variant for customers that aren’t sure of the footwear size. Once the customer purchases the “Not Sure” size, I would fulfill the order by sending them a physical sizing kit and at the same time, send them a digital copy of a gift card.
I’m looking to set up a shopify workflow that automatically sends a gift card to customers that is the same amount based on what is charged for the “Not Sure” size option. Subsequently, the customer could use the gift card to purchase a pair of the footwear once they have determined the size.
Appreciate any form of assistance on this, thank you!
You can set up this Shopify workflow by using Shopify Flow (if on Shopify Plus) or an automation app like Shopify Flow or Mechanic. First, create a condition in the workflow to check if the order contains the variant labeled “Not Sure.” Once that condition is met, trigger an action to generate a gift card for the same amount as the product price (you can use the order line item value). The gift card can then be emailed automatically to the customer using the same workflow. This lets the customer use the gift card later to purchase the correct size after using the sizing kit. If you’re not on Shopify Plus, you may need a third-party app like Mechanic to generate and email the gift card based on specific order conditions.
Thank you for taking time to look through this, appreciate it. This looks really promising. I’ve managed to duplicate the workflow. Just have a quick question regarding the invoice.
a. For the last action: Send order invoice, would that contain the details of the gift card?
b. Also, for the last action, how do I send it to the email of the person who purchased it. Do i include {{order.email}} field in the recipient email address? Thank you!
Thank you for the detailed instructions! I’ve replicated your flow but am unable to receive the invoice with the gift card. Here’s a screenshot of the variant that is “Not Sure” in my product page. Would you happen to know what else I am missing out? Thank you.
Problem here is that the “send invoice” action pulls order not from the original trigger, but from the newly created Gift Card – it has an order field and Flow automatically selects this one for the next action. I have not found a way to override this.
( @paul_n – do you know if it’s possible to select which object to use for an action? )
As a workaround we can try to reorder out actions – Send order invoice with Gift card code first and create Gift card via API afterwards.
Potentially, we can generate code for Gift card ourselves and supply it, like this:
{
"input": {
"initialValue": "{{lineItemsForeachitem.variant.price}}",
"customerId": "{{order.customer.id}}",
"note": "Not Sure variant purchase compensation for order {{order.name}}",
"code": "{{ lineItemsForeachitem.id | split:"/" | last }}sure"
}
}
Also, working with Gift cards can be difficult – they are protected. For example, once you’ve created a Gift card you can no longer retrieve it’s code, only last 4 characters are returned, so some workarounds I’ve considered did not work. The code is also limited to 20 characters and allows only a-z0-9…
I’d consider using Discounts instead, also Discounts can be tied to both Customer and product to secure it.
UPDATE: “send invoice” would not work like this, however, you do not need to send e-mail yourself – the system will send e-mail automatically as soon as you create a Gift card.
So you just need to create the gift card and it’s done:
Not possible to override it currently. You can instead use Send Admin API request to call the API directly. In that action you can specify your own order id
It’s just it not always makes the best judgement, while in conditionals you can choose your variables.
Say, in this flow (order created => loop over line items=> create gift card via API if applicable) if I want to, say, put Gift card code into customer metafield it gives me totally unexpected
sendAdminApiRequest.giftCard.order.purchasingEntity.PurchasingCompany.location.company.mainContact.customer.id instead of order.customer.id or, say sendAdminApiRequest.giftCard.customer.id …
Thanks Tim once again for the detailed advice. As an alternative to gift cards, how would the discount code work in shopify flow? Specifically in this case, how would a 100% discount code based on the product variant’s price work? Appreciate any form of assistance, thank you!
Hi Tim, yeah the gift card flow is working well now. However, I can’t seem to customise my gift card notification email.
Would you happen to know how I could show a customised message - “Thank you for your purchase, kindly use this gift card to offset your purchase once you have determined the size”. - in the gift card notification email. I’ve tried to include a note (Not Sure size) in the gift card API creation step and at the same time, inserted the following liquid code into the new gift card email template, but it doesn’t seem to be working. Appreciate any form of help, thank you!
{% if gift_card.note contains “Not Sure” %}
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.
This is amazing, after spending hours troubleshooting and waiting for shopify help to get back, it finally worked! Thanks much for your advice and help, really appreciate it.