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?