Storefront API orders line item variant return null

RemiLPE
Shopify Partner
9 0 4

Hello,

I am using Storefront API to get the order history of the users, then I list the different line_items. But some line_items have the variants object to null, I need this object because it contains several information.

RemiLPE_0-1623656032872.png

RemiLPE_0-1623656164028.png

 

Do you know why some line_item have the variants object to null?

Thank you.

Replies 5 (5)

Jason
Shopify Expert
11190 225 2282

Fair to assume that the items missing no longer exist in the shop? So the reference being nullified would be a reflection of that.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
RemiLPE
Shopify Partner
9 0 4

Hello Jason,

Thank you for your answer but this is not the case for all products. Some old products are no longer available, but others recent products are still available but with an empty object variant. 

bdi
Shopify Partner
2 0 0

Any news on this? I'm having exactly the same problem 
Items exists in the shop, status is set to active.
But the variants field returns null.

Also - if it was a reflection of the item missing or no longer existing howcome its returning valid data for title etc? 

Naren1
Shopify Partner
46 0 25

According to Shopify docs:

Deleted objects are not available in the API. The product variant ID is the only detail you can get when a product variant is deleted. Other details are not available.
https://help.shopify.com/en/manual/shopify-flow/reference/triggers/product-variant-deleted#api-detai...

I see that REST API returns the variantid but other details are null. whereas GraphQL returns variant null

scratchsoftware
Shopify Partner
2 0 0

We also are seeing this when using the checkoutCreate storefront mutation, no errors no issues, but this is what is returned for the checkout lineItems:

"lineItems": {
"nodes": [
{
"title": "Personalized Cartoon Phone Case",
"quantity": 1,
"variant": null
}
]
}

 

Any ideas? The product is available in the custom app's sales channel.

 

We can also query this ProductVariant node from the storefront api with no issues as well.

 

This only happens with random variants and we can't seem to figure out why.