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 |
---|---|
10 | |
4 | |
3 | |
3 | |
3 |
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023