All things Shopify and commerce
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hello Shopify Community,
I'm currently working on integrating draft orders via the Shopify Admin API, and I need assistance with a mutation request for creating draft orders. However, I'm encountering the following error:
Error: "Applied discount value can have at most 2 digits after decimal point"
Here’s the mutation query I’m trying to use:
mutation DraftOrderCreate($input: DraftOrderInput!) { draftOrderCreate(input: $input) { draftOrder { id } userErrors { field message } } }
payload = { "query": ''' mutation DraftOrderCreate($input: DraftOrderInput!) { draftOrderCreate(input: $input) { draftOrder { id } userErrors { field message } } } ''', "variables": { "input": { "email": "member@myapp.dev", "taxExempt": True, "tags": "myapp-order", "lineItems": [ { "variantId": "gid://shopify/ProductVariant/{id}", "quantity": 5, "appliedDiscount": { "amount": "6.98", # This is where the error seems to occur "description": "Price Difference", "value": 6.98, # This is where the error seems to occur "valueType": "FIXED_AMOUNT" } } ], "shippingAddress": { "firstName": "Van Beek", "address1": "Cedar Ln", "address2": "", "phone": "xxxx", "city": "Rock", "province": "Iowa", "country": "United States", "zip": "51246" }, "billingAddress": { "firstName": "Van Beek", "address1": "Cedar Ln", "address2": "", "phone": "xxx", "city": "Rock", "province": "Iowa", "country": "United States", "zip": "51246" }, "shippingLine": { "price": "5.95", "title": "Shipping" } } } }
Thanks in advance for any guidance!
can anyone help ?