Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
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
Solved! Go to the solution
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
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
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
@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.
@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
@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.
@Deep0617 No It's not possible, Let me explain to you how draft orders and actual orders work.
What you are trying to do has a working process as follow:
My Questions here is, if you need user to pay after clicking the reserve order button, why do you need a draft order?
@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 .