The DraftOrder API documentation has this:
Look at that last bullet: "Use the DraftOrder and Checkout resources to create a checkout from a draft order (sales channel apps only)."
But I couldn't find any explanation on how to do this. How to convert a draftorder object into a checkout object to be used with the checkout API.
I tried looking for a checkout ID or checkout token, but it's not there. Not even when completing the draftorder.
Can anyone clarify?
This looks like it can be phrased better. This sentence was refactored around 4 months ago from:
Use Draft Orders API in conjunction with the Checkouts API by creating a Checkout object based on a draft order (Sales Channel SDK only). based on a draft order (Sales Channel SDK only).
I'm going to get that corrected so it's less confusing, but I guess what it's trying to say is that you can use the draft orders API to template a checkout, and then create a checkout from what you end up with on your nearly finished draft order.
@Alex Is it correct though that you can exactly template a Checkout by a DraftOrder?
In DraftOrders, you're allowed to use (custom) discounts per line item. I can't see a possibility for this using the Checkout API?
@Alex - Thank so much for clearing it out, but what I still don't understand, and nowhere in the documentation or the forums it is explained, is:
How do I create a checkout from what I end up with on my nearly finished draft order?
It is quite what I understood too from the remark in the documentation, just don't understand how to do it.
I do believe it's possible because that's what the Shopify admin is probably doing - you create a draft order, and then you can send an email to the customer with a link to complete a checkout. I really want to know how to do it too 🙂
Yo @amosmos, I just found out that if you visit the draft_order.invoice_url, it will redirect you automatically to a checkout that is prefilled with all the DraftOrder line items, shipping lines and discounts.
@tolgapaksoy Thanks! Yes I'm aware of this, but it's not a checkout resource that I can use with the checkout API.
One example of the benefits of transforming a draft order into a checkout resource is that it will allow to add discounts (predefined in the store) to the order...
No, you are not. No matter what you send in `applied_discounts` fails. You can't use discount codes on Draft Orders
@gabrielnaologic I know you can't add discount codes to draft orders.
That's why I am looking to create a checkout object from the draft order, because you can add discount codes to a checkout object.
That's the whole point of this post.
Hi @JMartinezFSL ,
That KS for your note.
How do you update cart from draft order?
Thanks for the explanation. I think you misunderstood the case here.
What you suggest is just to add line items to the cart from the store's front-end.
For that we don't even need the draft order to begin with 🙂
We wanted to use draft orders to do unique things you can't do with the storefront (for example any kind of discounts) and we want to then make that a "checkout" object so we can pay for it through the api with the storefront api (not from the website's frontend).
But anyways that's an old post and since then Shopify corrected the docs and removed the note that it's possible to be done (as it's not).
I think this may be what I have been looking for! Let me explain. I send my customers draft orders from social media claims. They are used to being able to go into my store and add on to their invoice (the old platform I used) and pay everything all at once. I would like them to still be able to do this! Will this code allow for that? If so, where exactly do I put this code?
There still no way or documentation to do this?
I'm also trying to create a draftOrder instead of an order when user clicks on Pay Order. What I tryed is use webhooks from webhooks list, specificly DRAFT_ORDERS_CREATE to capture event and modify the order and then use mutation draftordercomplete to make an order from it. But the webhook DRAFT_ORDERS_CREATE, is never launch.
What I did is create a private app, that let me add products to my cart with some properties that determines their price, and then I use this properties to update the final order price. The problem is that when I update this order it is already paid, now I'm trying to make Capture Payment manually but for this you'll need a Payment App, but is on beta, etc
Hey @amosmos ,
I really need to do exactly the same as what you needed, do you have any luck doing it? I saw an app that actually does it, but not automatically, and instead you will click the "generate checkout link" in the draft order backend. I needed this to be done automatically, here's the app I'm talking about: https://apps.shopify.com/draft-helper