to edit and order by adding an discounted variant.
Hi @HunkyBill ,
I want to edit an order and add a free variant(variant would already be selected by the user on a form submission and added to customer metafield)
Once the order is placed, we need to edit the order and add the selected variant as free to the user.
So, i followed the guide https://shopify.dev/tutorials/edit-an-existing-order-with-admin-api#add-a-discount-to-the-variant and https://shopify.dev/docs/admin-api/graphql/reference/orders/ordereditaddlineitemdiscount.
I took the orderID and got the calculatedOrderID, using that calculatedOrderID, i added the variant as lineItem and got the calculatedLineItem.
Now using the calculatedlineItem, i need to apply 100% discount to that variant.
Please check my code. Am doing as per the documentation.
Kindly help me where am i wrong.
I had made a minor mistake and wanted to share so that it might help someone.
This orderEditAddLineItemDiscount is available in latest version
so Field 'orderEditAddLineItemDiscount' doesn't exist on type 'Mutation' in this url: "<myshop>/admin/api/graphql.json"
It works with "<myshop>/admin/api/2020-10/graphql.json"