Development discussions around Shopify APIs
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?
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.
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
User | RANK |
---|---|
11 | |
6 | |
5 | |
5 | |
5 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022