Development discussions around Shopify APIs
I am testing editing my order to replace the product that is being shipped.
My basic flow is
create an order in the test shop - set a discount code for $500 off the order
process the order in my nodejs to do the following:
orderEditBegin
orderEditSetQuantity of the item I want to remove (setting quantity to 0)
orderEditAddVariant adding the replacement product (which costs the same amount)
orderEditCommit
The problem comes in that the resulting calculatedOrder has a non zero totalOutstandingSet. In my original order I get:
"originalOrder":{"discountApplications":{"edges":[{"node":{"allocationMethod":"ACROSS","index":0,"targetSelection":"ALL","targetType":"LINE_ITEM","value":{"__typename":"MoneyV2","amount":"500.0"}}}]}
Do I need to re-add the discountApplications?
Solved! Go to the solution
This is an accepted solution.
Hey @longinoa ,
Happy to help you out with this. Yes, after adding the new line item and assuming the new line item added gets the same discount you would need to add it using orderEditAddLineItemDiscount before your commit.
Regards,
John
John C | Developer Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Hey @longinoa ,
Happy to help you out with this. Yes, after adding the new line item and assuming the new line item added gets the same discount you would need to add it using orderEditAddLineItemDiscount before your commit.
Regards,
John
John C | Developer Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog
User | RANK |
---|---|
58 | |
11 | |
8 | |
7 | |
6 |
Thanks to all who participated in our AMA with 2H Media on planning your 2023 marketing bu...
By Jacqui Mar 30, 2023Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023