I’m retrieving orders via the GraphQL API to build pick lists.
Some order line items return with a product that has a name but no product id or variant id. (I pasted an exemple of GraphQL output below)
To try to understand what’s happening, I requested the same Order via the Rest API.
When I do that, I get a field called product_exists
that is systematically false when the line item doesn’t have any product information but the name. (I copied a Rest API response below)
There is no trace of the product_exists
field in the documentation and I can’t find anything related in the GraphQL documentation. I need a id for the product of these line items to handle them.
What can I do ?
Exemple of GraphQL response
{
"code": 200,
"headers": {
},
"body": {
"data": {
"nodes": [
{
"id": "gid://shopify/Order/5855658705040",
"name": "#66430",
"lineItems": {
"nodes": [
{
"id": "gid://shopify/LineItem/14685259890842",
"name": "Headlamp Strap",
"currentQuantity": 1,
"sku": null,
"variantTitle": null,
"vendor": "",
"image": null,
"product": null,
"variant": null
}
],
"pageInfo": {
"hasNextPage": false,
"endCursor": "eyJsYXN0X2lkIjasdfasfOTg5MDg0MSwibGFzdF92YWx1ZSI6MTQ2ODUyNTk4OTA4NDF9"
}
}
}
]
},
"extensions": {
"cost": {
"requestedQueryCost": 7,
"actualQueryCost": 7,
"throttleStatus": {
"maximumAvailable": 20000,
"currentlyAvailable": 19993,
"restoreRate": 1000
}
}
}
},
"prev_page_info": null,
"next_page_info": null,
"api_call_limit": null,
"retry_request_after": null
}
Exemple of Rest response
{
"line_items": [
{
"id": 14685259890841,
"admin_graphql_api_id": "gid://shopify/LineItem/14685259890842",
"attributed_staffs": [],
"current_quantity": 1,
"fulfillable_quantity": 1,
"fulfillment_service": "manual",
"fulfillment_status": null,
"gift_card": false,
"grams": 0,
"name": "Headlamp Strap",
"pre_tax_price": "6.00",
"pre_tax_price_set": {
"shop_money": {
"amount": "6.00",
"currency_code": "USD"
},
"presentment_money": {
"amount": "6.00",
"currency_code": "USD"
}
},
"price": "6.00",
"price_set": {
"shop_money": {
"amount": "6.00",
"currency_code": "USD"
},
"presentment_money": {
"amount": "6.00",
"currency_code": "USD"
}
},
"product_exists": false,
"product_id": null,
"properties": [],
"quantity": 1,
"requires_shipping": true,
"sku": null,
"taxable": true,
"title": "Headlamp Strap",
"total_discount": "0.00",
"total_discount_set": {
"shop_money": {
"amount": "0.00",
"currency_code": "USD"
},
"presentment_money": {
"amount": "0.00",
"currency_code": "USD"
}
},
"variant_id": null,
"variant_inventory_management": null,
"variant_title": null,
"vendor": "",
"tax_lines": [],
"duties": [],
"discount_allocations": []
}
],
...
}