I'm a product manager on the orders team here at Shopify and I want to better understand if there's a need among Shopify app developers for fetching what's changed on an order.
When we released order editing back in late 2019, we introduced a new pattern where many attributes on an order could be updated — we even wrote a blog post about it! The new recommended practice was that for any function of your app that could be affected by an order attribute, you treat the attribute as potentially subject to updates.
With that in mind, do you have apps that need to keep informed of updates? How do you do that today (e.g subscribing to order/updated or order/edited webhooks)?
More importantly, I'd love to hear if you have a use case for retrieving a history of what attributes have changed on any given order and why — feel free to comment in this thread below or message me directly.
All the best,
Hi @Jordan ,
I'll pitch in with our use case, related to reporting and accounting.
When it comes to accounting/reporting, a rule of thumb is that past data should not ever change.
For example, if March is over and I generate a report for March as of today, and I generate the same March report as of tomorrow or next week, I expect the same results.
Unfortunately, this is not the case with the way the current order editing functionality works. Let me explain.
I tried editing an order by either increasing and decreasing the quantity on one of the order line item. Here is what I'm seeing:
1) If I decrease the quantity, a refund is added to the order and the refund's date (processed_at/created_at) is populated with the date of the edit. No problem here. We have all the info we need. Although, it would be nice to be able to tell that the refund was created because of an edit.
2) If I increase the quantity, the existing line item quantity is increased. There is no field in the API to indicate that the quantity was increased, and when.
As a result, the sales report data for that order is changed, as of the date when the order was originally processed. That's problematic. We changed the past!
I think the ideal solution would be to change this behavior. Instead of changing the existing line item, it should append a new line item with the delta quantity. The product and variant information would be the same as the original line item, but that's fine. Of course, this new line item would also need to have an additional date field to indicate when it was added.
An alternative solution might be to add a new array order.edits, which would contain all the edits made to the order. The items in the order.edits array would be of the same shape as the object included in the orders/edited webhook. We don't use the orders_edited webhook, because we cannot reconcile the data or recreate the data by querying the API. For example, if an orders/edited webhook wasn't delivered to the app for some reason, there is no way to reconstruct the information it contained. If there was a new order.edits array, we could just load the order. Also, it would be included in the orders/updated webhook.
I hope this helps, let me know if I wasn't clear as it is definitely a tricky topic.
Are there plans to act on the feedback I've given?
It's still giving us headaches because it's not possible to provide accurate reporting of edited orders.
Hi, we're working on a new API that should help alleviate this headache. If you're interested in gaining early access, send me an email at firstname.lastname@example.org and we'll set you up once the API is ready to be tested.
I wanted to share an API that we just released that I think your team might find useful: https://shopify.dev/changelog/retrieve-accurate-and-reliable-order-sales-data
@Jordan Is there any update on the status?
We are happy to test it and work with merchants who have requested this feature to gather feedback.