GraphQL orderEditAddLineItemDiscount & CurrencyCode

Solved

GraphQL orderEditAddLineItemDiscount & CurrencyCode

selask
Visitor
3 1 1

I am passing this as GraphQL via the API to add a discount to a line item:

 

mutation addDiscount { orderEditAddLineItemDiscount ( id: "gid://shopify/CalculatedOrder/48968941151", lineItemId: "gid://shopify/CalculatedLineItem/cedb9a39-2a49-4c1c-927a-51c2a26a3738", discount: { fixedValue: { amount: "2.11", currencyCode: "USD" }, description: "Surcharge Adjustment" } ) { calculatedOrder { id addedLineItems(first:2) { edges { node { id quantity } } } } userErrors { message } } }

 


Error coming back is

Argument 'currencyCode' on InputObject 'MoneyInput' has an invalid value ("USD"). Expected type 'CurrencyCode!'.

What do I need to pass in for CurrencyCode? All the examples I have seen online just have the string "USD" passed in.

Accepted Solution (1)

selask
Visitor
3 1 1

This is an accepted solution.

I solved it.

 

currencyCode: "USD" is incorrect, pass it in without quote:

currencyCode: USD

View solution in original post

Reply 1 (1)

selask
Visitor
3 1 1

This is an accepted solution.

I solved it.

 

currencyCode: "USD" is incorrect, pass it in without quote:

currencyCode: USD