Hi Shopify Community,
I’m encountering an issue with the draftOrderCreate
GraphQL mutation when applying a fixed amount discount to a line item. Despite formatting the appliedDiscount.value
field to exactly two decimal places, the mutation consistently fails with this error:
Error: Applied discount value can have at most 2 digits after decimal point
Field Path: lineItems[0].appliedDiscount.value
We’re building a custom integration to programmatically create draft orders with a fixed amount discount applied per line item. Here’s a simplified example of the mutation payload we’re sending:
{
"variantId": "gid://shopify/ProductVariant/49974694904086",
"quantity": 3,
"appliedDiscount": {
"amount": "42.65",
"description": "TFM Price Difference",
"value": 42.65,
"valueType": "FIXED_AMOUNT",
"title": "TFM Discount"
}
}
What We’ve Tried
Used decimal.Decimal in Python to calculate and round the discount value precisely to 2 decimal places (Decimal(‘0.01’) with ROUND_HALF_UP).
Verified the payload is being serialized correctly with custom JSON encoding (e.g., 42.65 is not turning into 42.650000000000006).
Removed amount field to see if there was a conflict — still the same error.
Manually tested mutation using Shopify’s GraphiQL admin app with the same input — still fails.
Tried with smaller values (e.g., 1.00) — still fails.
Questions
Is this a known issue or limitation in the DraftOrder API?
Are there undocumented constraints or formatting expectations for appliedDiscount.value?
Should we be using a different data type or approach to ensure compliance with Shopify’s backend validation?
1 Like
I don’t use this exact API but can you pass the value
as a string?
Hey @Ravi_Ighare
I tested your exact payload format (including both "amount": "42.65"
and "value": 42.65
fields together) and it worked without any errors in my environment. @dogowner’s suggestion to pass the value
as a string doesn’t work though. The GraphQL schema rejects it with a coercion error since that field expects a number.
Since the exact formatting you’re using works fine when I test it, the issue might be specific to your environment, GraphQL client, or how the values are being serialized before reaching the API. Since you mentioned that you’ve tested that already, can you share an x-request-id from the mutation returning the errors? I may be able to pull some additional insight from our logs.
Hey @Ravi_Ighare,
Are you still experiencing this issue, or can I mark this as solved?
The issue still persists and occurs only with bundle-type products, and only when the discount type is set to a fixed amount. @KyleG-Shopify
i have used Bundled app on my store to create Bundled which includes multiple products
Thanks for sharing that. Based on that post, it looks like this has been happening for a long time.
Knowing this is happening with a bundle product looks to be the key piece here. I was able to replicate the error. From my testing, this appears to happen when the amount that gets distributed to the individual bundle products results in a calculation with more than 2 decimal places.
I’m not 100% sure, so I’m consulting with our internal developers to find out. In the meantime, rounding up to the nearest dollar should prevent this on those orders.
I’ll report back here once I know more.
Thank you for your help! Please let me know once you’ve found a solution.
@KyleG-Shopify This is very critical for our business operation so lets please take action on this quick
Thanks for the follow up Ravi.
We have created an internal issue to investigate this, but I don’t have a timeframe at this point. Can you share a little more about the impact to your operations? I want to be sure our team knows this so it’s appropriately prioritized.
Thank you for the folo up
This issue is critical for us. We lose at least one order every week, ranging from $40 to $200, because of it. We tried using a percentage discount as a workaround, but it alters the final order total, which is not acceptable.