Deleted Product reference not null in Order

Jiten
New Member
1 0 0

I am getting the product_id and variant_id in the order line item even if the product is deleted from shopify store.

It even says product_exists true. Can you please tell me why this happens and is there any way that I can detect if the

product exists or not without making any addition API calls?

Replies 2 (2)
Evulse
Shopify Partner
411 0 65

This is a bit of a pain, we suffer the same issue in our applications. We already have all product details so we compare it to that, however I understand this is a bigger issue when this isn't available.

We find many applications cause this problem such as any application that offers tiered pricing. These applications delete and recreate variants all the time and break the connection to the original product.

+1 on adding something to identify this without needing to scan through all products.

Want an app but can't find what you need? Let us know we custom build apps for Free
Chris_Saunders
Shopify Staff
Shopify Staff
591 0 52

Looking through our code, all line_items should be getting their product_id value nullified on product destruction. I just tested out creating a product, buying it and destroying it. And I'm still seeing the product_id and variant_id in my API responses.

For now, I'd say you could perhaps subscribe to product delete webhooks and keep note of them somewhere. I'll file an issue and we'll post an update to the API announcements area when a patch goes out.

Chris | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog