A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
https://shopify.dev/api/admin-graphql/2021-10/mutations/draftOrderCreate
I'm trying to set a "Due Date" while creating a Draft Order.
I've tried using the "Shopify GraphiQL App" to try executing the query but I get "Access denied" in return.
I've selected all the permission from "Admin API" while installing the "Shopify GraphiQL App", so I'm pretty sure I've got all the permissions.
The query and variables below works if I remove the "paymentTerms". Any idea what I've done wrong?
Thanks.
mutation draftOrderCreate($input: DraftOrderInput!) {
draftOrderCreate(input: $input) {
draftOrder {
id
}
userErrors {
field
message
}
}
}
------------------
{
"input": {
"customerId": "gid://shopify/Customer/XXXX",
"lineItems": [
{
"variantId": "gid://shopify/ProductVariant/YYYYY",
"quantity": 1
}
],
"paymentTerms": {
"paymentSchedules": {
"dueAt": "2021-12-31T00:00:00Z"
}
}
}
}
Solved! Go to the solution
This is an accepted solution.
Hey @kmatsumo
That specific field requires access to the payment_terms scope. It's available for private apps, but not currently for the GraphiQL admin app, which is why you would receive an error when performing this operation through that interface.
You can manually apply the necessary permission to a private app and run your GraphQL query that way while we work on making this scope available to the GraphiQL app.
I hope this helps!
Best,
To learn more visit the Shopify Help Center or the Community Blog.
This is an accepted solution.
Hey @kmatsumo
That specific field requires access to the payment_terms scope. It's available for private apps, but not currently for the GraphiQL admin app, which is why you would receive an error when performing this operation through that interface.
You can manually apply the necessary permission to a private app and run your GraphQL query that way while we work on making this scope available to the GraphiQL app.
I hope this helps!
Best,
To learn more visit the Shopify Help Center or the Community Blog.
Hey, sorry for the late reply!
Thank you, it is not giving me the error after adding the scope.
(Although I'm encountering another error, I'll try figure it out my self for now)
Would be nice if the documents were a bit more clearer so I know which scopes are needed.
Or I might have not reading it properly...
Thanks once again.
I believe this is currently the only way to manage it.
Thanks @kmatsumo . I am trying to do this by following your query exactly, but it is giving me the following error:
{"data":{"draftOrderCreate":{"draftOrder":null,"userErrors":[{"field":null,"message":"Payment terms template id can not be empty."}]}}
Did you not run into this?
@bbarrYes I did. Unfortunately I could not solve the problem in time. I currently am not working on that project anymore so I did not do further research to fix it. Sorry I couldn't help.
If you manage to solve it, it would be nice if you shared it 🙂
@kmatsumoThis is classic Shopify, they hid a bunch of data that you have to eventually guess exists and go looking for it. No documentation for it, no references in how-to or post.
{
paymentTermsTemplates {
id
dueInDays
}
}
This will give you a list of various "templates" to use. This has been yet another terrible developer experience.
@bbarrI agree. The only solution now you have is to create a question and hope one of the devs or someone that knows the answer will answer...
Or do some grinding and figure it out your self... 😞