What's your biggest current challenge? Have your say in Community Polls along the right column.
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.

How to calculate draft order when currency is not the shop currency?

How to calculate draft order when currency is not the shop currency?

mrinmoy_dev
Shopify Partner
5 0 1

Hi,

We are calculating and creating draft order through our custom app using shopify admin GraphQL draftOrderCalculate and draftOrderCreate API service.

The challenges we are facing currently now that once creating any draft order in shop currency (USD) and then we changes the presentment money of the entire draft order to other currency (e.g. GBP) using draft order calculate service it works fine, but after that if we want to apply any discount or other things to any product in the presentment money (i.e. GBP), now we are unable to calculate draft order properly as draft order calculate API needs entire input payload value in shop currency (i.e. USD in our case) but we have just switched earlier from USD to GBP.

Is there anyway we can provide this new currency (i.e. GBP) to request payload to draft order calculate service ?

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 525

Hi @mrinmoy_dev,

 

Thanks for your post. The fixed amount discounts specified through the DraftOrderInput.appliedDiscount value are in the shop currency, so you'd need to convert to that from the presentment currency beforehand and use the shop currency value in the mutation discount input. This is confirmed by testing with fixed discounts and adjusting the DraftOrderInput.presentmentCurrencyCode in the draftOrderCalculate mutation.

 

There's some great developer docs about managing draft orders with the draftOrderCalculate and draftOrderCreate mutations at this link:

https://shopify.dev/docs/apps/b2b/draft-orders

 

If you're still having trouble please provide some more specific info about the inputs being used and what about the return value doesn't match what's expected.

 

Thanks and hope you have a great day

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