How do I export the total amount for refunded gift card transactions from a Shopify order?

When a customer uses a gift card along with a credit card to pay for the order and the credit card portion of the transaction fails, Shopify rolls back the gift card payment as well by creating a "refund" transaction for it.

To export the total of all refunded gift card transacitons with EZ Exporter, you can use the formula below:

get_total([float(i.amount) for i in load_json_data({{ transactions.successful_transactions }}) if i.gateway == "gift_card" and i.kind == "refund"])

You can also subtract this value from the original total of all gift card sale transactions using this formula to give you the final gift card ammount applied to the order:

{{ transactions.gift_card.total_amount }} - get_total([float(i.amount) for i in load_json_data({{ transactions.successful_transactions }}) if i.gateway == "gift_card" and i.kind == "refund"])

Related Articles:


App: EZ Exporter

Tags: advanced features, calculated fields, gift card