Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Get added products for an order after being paid

Get added products for an order after being paid

Vocinglero
Shopify Partner
8 0 3

Hi,

 

Our app (accounting software) needs to know edits made on a paid order. Since there is no API that can return the edits made on an order I'm trying to find the best way to do that with the Order object. Basically we need to know, after an order has been pais, which products have been added or removed.

 

Removed products

The "refunds" attribute lists removed articles so I assume this is OK

 

Added products

Since the "line_items" attribute contains all products (originals + added after payment) but no timestamp we cannot use this. The Event API does not detail the modification neither...

The Order Status Page gives a summary of added and removed products but I guess this page does not rely on the same API and it has access to more info.

 

I've been searching for days but nothing gives relevant results.

 

Does anyone have found solution to get edit details?

 

Kind regards, and happy 2023!

 

Gregory

Replies 3 (3)

ShopifyDevSup
Shopify Staff
1453 238 527

Hey @Vocinglero - this is a great question, thanks for reaching out. My suggestion for the best solution here, would be to set up an order/edit and order/updated webhook subscription for your app. There is a full list of webhooks here, and more info on them conceptually/set-up wise here.


By setting up the webhook subscription you would get updated information formatted in JSON sent whenever a merchant edits an order. This data would include information related to when an item is added/removed, along with a timestamp of when the edit happened. It would also include a specific removal or addition ID. This ID is related to each line item rather than the full line items attribute, which would make tracking individuals easier on order edits.


Let me know if I can clarify anything on our end - hope this helps give you a way forward toward building this process into your app. Happy new year!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Vocinglero
Shopify Partner
8 0 3

Hi, thanks for your answer,

 

Yes webhooks is a good solution for new coming orders but our app also deals with past orders so this solution does not work for that use case 😞

 

Regarding webhooks, what do you mean by "It would also include a specific removal or addition ID"? Is something contained in the JSON payload? I use the REST API and the webhook payload (for creation, update, ...) is the Order JSON with "line_items" attribute.

 

Thanks,

 

Gregory

ShopifyDevSup
Shopify Staff
1453 238 527

Hi @Vocinglero 

 

The orders/edited webhook's payload has additions and removals fields nested under the line_items field. This should make tracking specific changes easier as they happen. 

 

For past orders I would recommend looking at using our GraphQL Admin API, which exposes more details which might help your use case such as:

 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog