FROM CACHE - en_header

Draft Order API

Solved
abdul81
Shopify Partner
16 1 1

We have developed a Shopify app and working on adding new features.

 

For our latest feature in development, we are using draft order api and creating draft orders and redirecting user to draft checkout preview.

 

Feature: User add the products to cart our server creates a draft order and redirects customer to draft checkout.

 

There are 2 cases:

 

Case1: Customer completes the checkout, draft order will automatically be completed and order is created. (pretty straight forward.)

 

Case2: Customer abandoned the checkout, now the draft order is appearing in Shop admin as open. (This is where we are stuck and unable to find any API solution).

 

Question Based on Case 2. Is there a way to delete that particular draft order if customer abandoned the checkout? so merchant don't see tons of open draft order and app cleans up every-time when there is an Abandoned draft checkout created by the app. We don't see any webhook or api related to that. If someone direct us in right direction that will really be helpful.

 

Best Regards

Product Manager at Developer's Capital

  • Creator of App Quantity & Volume Discounts
  • Was my reply helpful? Click Like to let me know!
  • Was your question answered? Mark it as an Accepted Solution
Accepted Solution (1)

Accepted Solutions
abdul81
Shopify Partner
16 1 1

This is an accepted solution.

Since the app creates draft order and redirect user to draft checkout in run time (same time when the draft order is created) the best solution is to subscribe to draft/order_create topic and after redirecting the user to checkout delete the open draft order, customer can still checkout. This is the best solution we can develop so-far. Hope this helps someone.

 

Thanks

Product Manager at Developer's Capital

  • Creator of App Quantity & Volume Discounts
  • Was my reply helpful? Click Like to let me know!
  • Was your question answered? Mark it as an Accepted Solution

View solution in original post

Replies 7 (7)
abdul81
Shopify Partner
16 1 1

Just adding a reply so the topic don't die, We are still knee deep in mud with this. If any can give an idea of direct us in a right direction (Any API solution) That's would be very helpful

 

Thanks

Product Manager at Developer's Capital

  • Creator of App Quantity & Volume Discounts
  • Was my reply helpful? Click Like to let me know!
  • Was your question answered? Mark it as an Accepted Solution
abdul81
Shopify Partner
16 1 1

This is an accepted solution.

Since the app creates draft order and redirect user to draft checkout in run time (same time when the draft order is created) the best solution is to subscribe to draft/order_create topic and after redirecting the user to checkout delete the open draft order, customer can still checkout. This is the best solution we can develop so-far. Hope this helps someone.

 

Thanks

Product Manager at Developer's Capital

  • Creator of App Quantity & Volume Discounts
  • Was my reply helpful? Click Like to let me know!
  • Was your question answered? Mark it as an Accepted Solution
Deep0617
Shopify Partner
12 0 2

@abdul81I will suffer with this problem, is any way to when user add to cart product and make payment then order are not create but draft-order create.

 

 

abdul81
Shopify Partner
16 1 1

@Deep0617 If a user adds a product to the cart and checkout/make payment etc.... then it's a Shopify standard flow, an order has to be created, there is no draft order in it. Learn More about Draft order here . Now the question if your use-case do need a draft order then you should send a draft order creation request to your server instead of user going to checkout. You can learn more about the things you can do with the draft order API here.

 

Thanks

Product Manager at Developer's Capital

  • Creator of App Quantity & Volume Discounts
  • Was my reply helpful? Click Like to let me know!
  • Was your question answered? Mark it as an Accepted Solution
Deep0617
Shopify Partner
12 0 2

@abdul81Thanks for Reply.
I want to create one button name with reserve order.
->When user click that button then redirect to payment page.
->After sucessfull payment the order will be created as draft in draft order admin page and also product quantity decrease from inventory.

Is This possible?

Thanks.

abdul81
Shopify Partner
16 1 1

@Deep0617 No It's not possible, Let me explain to you how draft orders and actual orders work.

 

  1. The order can't be converted to a draft order
  2. You need to create a draft order first and then send an invoice to customer so they can pay and complete the order, after that the draft order will be converted to an actual order. 

What you are trying to do has a working process as follow:

 

  1. User clicks on a button, you create a draft order through draft order Api
  2. Redirect user to draft order checkout, At this stage the draft order is appearing under the Draft Orders in Shopify
  3. If user abandon the checkout, it will remains under the Draft orders
  4. If user completes the checkout, then You will see a Draft Order with status "Completed" and an actual order saying "Created from draft order"

My Questions here is, if you need user to pay after clicking the reserve order button, why do you need a draft order?

Product Manager at Developer's Capital

  • Creator of App Quantity & Volume Discounts
  • Was my reply helpful? Click Like to let me know!
  • Was your question answered? Mark it as an Accepted Solution
Deep0617
Shopify Partner
12 0 2

@abdul81I need to when user click the reserve button draft order created and decrease item from inventory
->I will send the invoice to customer  manually then he will make payment .