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...
@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.