Automatically issue digital gift card post purchase of a certain size of shoe

I know now :slightly_smiling_face:

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:

It would be possible to customize the e-mail in Gift card template in Settings=> Notifications.