Replace gift card page

Hello!
I’m currently working on a page to replace the gift_card.liquid file. And, for this project, I’m using the graphQL API to fetch information from shopify. As stated in the documentation for the ‘gift_card.liquid’ page, the variables that I have are the store id and the gift card token.

https://checkout.shopify.com/gift_cards/[store_id]/[gift_card_token]

So, my question is, is there a way to fetch the information of a gift card (including the gift card code to display it on my page) using the gift card token (since it is the only reference I have of the gift card)?

Hi @JonathanNaranjo

From the documentation you’ve linked to, specifically here they mention:

You can access the Liquid gift_card object to display the gift card details.

The Liquid gift_card object is detailed here and should give you all the information you need:

{
  "balance": 5000,
  "code": "WCGX 7X97 K9HJ DFR8",
  "currency": "CAD",
  "customer": {},
  "enabled": true,
  "expired": false,
  "expires_on": null,
  "initial_value": 5000,
  "last_four_characters": "DFR8",
  "pass_url": "https://polinas-potent-potions.myshopify.com/v1/passes/pass.com.shopify.giftcardnext/94af7fbe55d010130df8d8bc4a338d36/",
  "product": {},
  "properties": {},
  "qr_identifier": "shopify-giftcard-v1-3TKWJKJBM3X7PBRK",
  "template_suffix": null,
  "url": "https://checkout.shopify.com/gift_cards/56174706753/0011c591fc720d0a51b80cdb694f969e"
}

That can be used like a standard liquid variable.

The Dawn Theme example is a good place to look to see how the liquid variable can be used to create the page - https://github.com/Shopify/dawn/blob/main/templates/gift_card.liquid

Hope that helps!

Hi @SB_90 !

Thanks for your reply! However, I’m not using a liquid based project now. I’m currently migrating to a react app. But, I am still using the shopify information. So, I cannot really use the liquid syntax.

Thanks!