Conversion of a abandoned checkout to draft order using shopify flows

Solved

Conversion of a abandoned checkout to draft order using shopify flows

shubhammathur45
Shopify Partner
5 0 1

Hello,

In one of my usecase, I am trying to convert an abandoned checkout to a draft order. We want to automate this process so want to do it using flows. 
Any suggestions on how to achieve that?

I tried to start a flow on abandoned checkout and then use "Create Draft Order" action. But an error comes when i run the flow. The error displays "order_id which is a required field is missing". Not sure what to put in order_id. Tried a few variables but nothing worked. 


Accepted Solution (1)

RPiii
Shopify Staff
117 20 36

This is an accepted solution.

I'm not familiar with a "Create draft order" action in Flow. You may be able to accomplish this with a Customer abandons checkout trigger followed by a Send Admin API request action that uses the draftOrderCreate mutation that populates the relevant fields using Liquid from the Customer and Abandonment objects returned by the trigger. In effect, you might be able to update draftOrder.lineItems with the details from Abandonment.productsAddedToCart.

View solution in original post

Replies 6 (6)

RPiii
Shopify Staff
117 20 36

This is an accepted solution.

I'm not familiar with a "Create draft order" action in Flow. You may be able to accomplish this with a Customer abandons checkout trigger followed by a Send Admin API request action that uses the draftOrderCreate mutation that populates the relevant fields using Liquid from the Customer and Abandonment objects returned by the trigger. In effect, you might be able to update draftOrder.lineItems with the details from Abandonment.productsAddedToCart.

shubhammathur45
Shopify Partner
5 0 1

Hello,

Thanks for your response. It is helpful and working for my use case. 


shubhammathur45
Shopify Partner
5 0 1

Hello @RPiii ,

I have a small query in this flow. I implemented this this and it is working fine. But the only problem is that the shipping price in the draft order is not coming as expected. It is not the same as abandoned order. 
Can you please let me know that which variable can i use in the liquid code to fetch the shipping price from abandoned order?
I tried a few variables but all of them have a blank value. I want to fetch the correct shipping amount for the draft order. Here, even if i hardcode it as "30.00", it comes as a $0.00 in draft order. 
Input JSON (only the shipping part):
"shippingLine": {
"priceWithCurrency": {
"amount": 30.00,
"currencyCode": "USD"
},
"shippingRateHandle": "",
"title": ""
}


shubhammathur45
Shopify Partner
5 0 1

Basically, I am not able to figure out that in which field is the shipping price stored? I tried to map many fields but none of them returns the correct shipping amount. 

RPiii
Shopify Staff
117 20 36

Unfortunately, I don't see any shipping details included in the Abandonment.

shubhammathur45
Shopify Partner
5 0 1

Okay thank you. Do you suggest anything else if i need to retrieve shipping details and use it is createDraftOrder mutation?