How can I include optional fields for gift cards via the Storefront API?

Topic summary

Shopify Storefront API usage for selling gift cards with extra checkout fields (recipient email, gift message, and variant/denomination). The goal is to pass these values so they populate the Liquid email template that delivers the gift card.

Key details:

  • Current state: Products and gift cards can be added/processed via Storefront API without issues.
  • Open question: How to include optional fields (recipient email, message) at checkout via Storefront API and make them available to the gift card notification Liquid template.

Additional input:

  • Another participant faces the same issue. They can capture recipient details on a Gift Card page form and attach them to the cart line item as attributes, but aren’t sure how to correctly link these to the gift card email workflow.
  • Shopify docs indicate this behavior works in default Shopify templates, but it’s unclear how to achieve the same via Storefront API.

Status: Unresolved; no confirmed solution or implementation steps shared.

Summarized with AI on December 24. AI used: gpt-5.

Hi,

For a Shopify website integration, I’m using the Shopify Storefront API.

I can add products and gift cards to the shopping cart and process them without any issues.

However, there’s one point that isn’t entirely clear to me:

How can I include optional fields when checking out gift cards via the API? What I want to achieve is as follows:

Someone wants to purchase a gift card on the website and give it to someone else. They fill in the ‘recipient (email),’ message, and choose a variant on the website. For example:

Recipient: friend@example.com

Message: ‘Hey, congratulations on your birthday, here’s a gift card for your favorite online store, best wishes, Tim’ Variant: 25 euros

How do I send these (additional) fields through the Storefront API so that I can use them in the Liquid template used when sending the actual gift card?

Thank you,

Best regards, Koen.

4 Likes

@dhoorekoen just came across your question as I am facing the same problem. Were you able find a working solution? I have setup a form for the Gift card page which allows me to store the ‘recipient (email)’ etc and pass them into the line item as attributes but wondering how we can connect this correctly as I read in the below this behaviour is achievable in the default Shopify templates:
https://help.shopify.com/en/manual/products/gift-card-products/overview

Any guidance would be greatly appreciated!