Missing isGiftCard field in lineItems using graphQL

Highlighted
New Member
6 0 0

Hi,

 

I was wondering why there is no isGiftCard-Field on the LineItem-Object.

The Field appears on DraftOrderLineItem-Objects.

 

Thanks and cheers,

Norbert

 

0 Likes
Shopify Staff
Shopify Staff
459 59 71

Hey @HeartCoding,

 

I'm not sure of the reasoning behind this, but you can access it via LineItem.product.isGiftCard:

 

lineItems {
  edges {
    node {
      product {
        isGiftCard
      }
    }
  }
}

 

0 Likes
Highlighted
New Member
6 0 0

Thanks @scottydont for your answer.

I've thought about this, too. But it doesn't work on all occasions.

For example: If a gift card is issued over POS I get no associated product:

Part of GraphQL response:

'node':{ 
     'id':'gid://shopify/LineItem/4481952940111',
     'fulfillmentStatus':'fulfilled',
     'name':'Geschenkgutschein (Versand per E-Mail)',
     'discountedTotalSet':{ 
        'shopMoney':{ 
           'amount':'20.0'
        }
     },
     'product':None,
     'variant':None,
     'quantity':1,
     'taxable':False,
  }

Part of Rest Response:

{
    "id": 4481952940111,
    "variant_id": null,
    "title": "Geschenkgutschein (Versand per E-Mail)",
    "quantity": 1,
    "variant_title": "",
    "vendor": null,
    "product_id": null,
    "taxable": false,
    "gift_card": true,
    "name": "Geschenkgutschein (Versand per E-Mail)",
    "product_exists": false,
    "price": "20.00",
    "total_discount": "0.00"
}

I now I could match it by the title/name attribute.

But it would be much easier to also mirror the isGiftCard field for LineItems in GraphQL.

 

 

0 Likes